Last active
December 30, 2016 15:22
-
-
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/
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
| /* 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