Remove WordPress Read More Link

Wordpress When you use the WordPress the_content() function inside the post loop it allows you to display the entire content of the post.

If your content has a html comment of more, the_content function will stop at this point and will place a read more link at this point. This allows your visitors to click on this link and it will take you to post at exactly where you left off.

But what if you don't want this read more link then you need to run the following code snippet, add this to your functions.php file to remove the read more link.

function remove_more_link($link) {
	$offset = strpos($link, '#more-');
	if ($offset) {
		$end = strpos($link, '"',$offset);
	if ($end) {
		$link = substr_replace($link, '', $offset, $end-$offset);
	return $link;
add_filter('the_content_more_link', 'remove_more_link');
Back to top

Learn how to code with Treehouse

  • Learn projects with access to 1000+ videos
  • Practice live with our Code Challenge Engine
  • Get help in our members-only forums

Start with a 7 day free trial