Read More Functionality WordPress

3d Animation

Some quick bits of code to help to style and customise the read more functionality in blog posts and post archives in WordPress.

First up – changing the ‘Read More’ text

function modify_read_more_link() {
    return '<a class="more-link" href="' . get_permalink() . '">Your TEXT Here</a>';
add_filter( 'the_content_more_link', 'modify_read_more_link' );

By default when you click on the ‘read-more’ link, browsers will jump you / page scroll you to the next bit of text (after the read more bit). Sometimes this takes you to the middle or the bottom of the single blog post page.
If you’d prefer to always be taken to the top of the selected post page, you can simply disable the page scroll functionality

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' );