You are here:
  1. Home
  2. Blog
  3. Forcing a 'read more' link on WordPress excerpts

Forcing a ‘read more’ link on WordPress excerpts

 | Code Snippet code snippet PHP
add_filter( 'excerpt_more', function ( $more ) { return ''; } );

function custom_excerpt_filter( $text, $raw_excerpt ) {
	global $post;
	return $text . '… <a class="read-more" href="'. get_permalink( $post->ID ) . '">read more &raquo;</a>';
}
add_filter( 'wp_trim_excerpt', 'custom_excerpt_filter', 10, 2 );
Jem Turner jem@jemjabella.co.uk +44(0)7521056376

Follow on Instagram