0

When you insert the "More" link into a post using the "Insert More Break" toolbar icon, the url that is generated is appended with "#more-". Thus when you click that link, you get the full post (via single.php), but the browser then scrolls to where the 'more' was inserted.

Is there a filter I can use to remove the "#more-"?

What I want is to not scroll to the 'more' link when the full post is displayed. Thanks.

2 Answers 2

2

There you go this will prevent scroll (add to functions.php)

function remove_more_link_scroll( $link ) {
$link = preg_replace( '|#more-[0-9]+|', '', $link );
return $link;
}
add_filter( 'the_content_more_link', 'remove_more_link_scroll' );

Explained in depth Here.

2
  • Excellent - thanks Dejo Dekic - just what the doctor ordered. Commented Jan 27, 2016 at 0:18
  • Cool glad to help:)
    – Dejo Dekic
    Commented Jan 27, 2016 at 0:35
1

I know a rather simple way to achieve that, with just one line of code.

the_content( '' );

Note that you have to use it in the templates responsible for displaying the content at appropriate places, and not in functions.php. I bet you won't see that #more... link again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.