Rudi Dicks

//Durban programmer

WordPress trick #2

Using the “Read More” tag in WordPress has its uses, but there is one simple trick to fix an annoying feature. By default, the function scrolls to the last read position in a post. Here is how you can disable this feature.

  • Navigate to the functions.php file
  • Add the following code to the file
    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' );

This stops the tag from scrolling to the last read position of the post, meaning that the page location is set to the top.

Leave a Reply

Your email address will not be published. Required fields are marked *