Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WP - Change excerpt more - only active where excerpt is customized
//* Change excerpt more - only active where excerpt is customized
function manual_excerpt_more( $excerpt ) {
$excerpt_more = '';
if( has_excerpt() ) {
$excerpt_more = '&nbsp;<a href="' . get_permalink() . '" rel="nofollow">[Read more]</a>';
}
return $excerpt . $excerpt_more;
}
add_filter( 'get_the_excerpt', 'manual_excerpt_more' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment