Add a "Continue Reading" Link to Excerpts
Replaces the [...] at the end of automatic excerpts with an accessible "Continue reading" link to the full post.
Opens WPIDE on
Code
add_filter( 'excerpt_more', function () {
if ( is_admin() ) {
return ' …';
}
return sprintf(
' … <a class="read-more" href="%1$s">Continue reading<span class="screen-reader-text"> %2$s</span></a>',
esc_url( get_permalink() ),
esc_html( get_the_title() )
);
}, 999 );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.