Skip to content

Instantly share code, notes, and snippets.

@waviaei
Last active December 30, 2016 15:22
Show Gist options
  • Select an option

  • Save waviaei/4577142 to your computer and use it in GitHub Desktop.

Select an option

Save waviaei/4577142 to your computer and use it in GitHub Desktop.
WordPress: when "read more" link is used, WordPress will automatically add "#more" anchor to the link. This is function to remove it. via http://webdesignrecipes.com/wordpress-functions-php-snipets/
/* remove more-anchor from read more link */
function remove_more_jump_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_jump_link');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment