How to add “Read More” link with the_excerpt()

When we use the_excerpt() to show the post excerpt, by default it shows ‘[…]’, which means “read more”. But what if we want to show an actual “read more” text (or maybe something else) with link to the post?

We can achieve this by filtering the_excerpt. But that also has some problem, as several filters is being applied before displaying the excerpt. notably the autop. From WordPress doc:

Displays the excerpt of the current post after applying several filters to it including auto-p formatting which turns double line-breaks into HTML paragraphs. It uses get_the_excerpt() to first generate a trimmed-down version of the full post content should there not be an explicit excerpt for the post.

We can use get_the_excerpt filter to avoid messing with other filters.

 * Remove the [...] string and anything else (if available) in the excerpt
add_filter( 'excerpt_more', '__return_empty_string', 99 );

 * Read more link on the_excerpt
function careless_excerpt_read_more_link( $excerpt ) {
    $excerpt .= sprintf(
        '... <strong><a class="read-more" href="%s">%s</a></strong>',
        esc_url( get_permalink() ),
        __( 'Read More &raquo;' )

    return $excerpt;
add_filter( 'get_the_excerpt', 'careless_excerpt_read_more_link', 99 );

Code goes in the functions.php file of your active theme.