Skip to main content
Home / Code Snippets / WordPress / Replace Excerpt Ellipsis with Permalink

Replace Excerpt Ellipsis with Permalink

This is useful if you would like to replace the ellipsis [...] from the excerpt with a permalink to the post.

functions.php addition:

function replace_excerpt($content) {
       return str_replace('[...]',
               '<div class="more-link"><a href="'. get_permalink() .'">Continue Reading</a></div>',
               $content
       );
}
add_filter('the_excerpt', 'replace_excerpt');
icon-link icon-logo-star icon-search icon-star