Paulund
2012-04-26 #wordpress

Remove WordPress Read More Link

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');