Created
July 15, 2014 10:03
-
-
Save aderaaij/459028ce194b48c5db24 to your computer and use it in GitHub Desktop.
Remove the # anchor after more links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function remove_more_tag_link_jump($link) { | |
$offset = strpos($link, '#more-'); //Locate the jump portion of the link | |
if ($offset) { //If we found the jump portion of the link | |
$end = strpos($link, '"', $offset); //Locate the end of the jump portion | |
} | |
if ($end) { //If we found the end of the jump portion | |
$link = substr_replace($link, '', $offset, $end-$offset); //Remove the jump portion | |
} | |
return $link; //Return the link without jump portion or just the normal link if we didn't find a jump portion | |
} | |
add_filter('the_content_more_link', 'remove_more_tag_link_jump'); //Add our function to the more link filter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment