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>',
add_filter('the_excerpt', 'replace_excerpt');


  1. User Avatar
    Permalink to comment#

    Very useful, tried and tested, thanks.

  2. User Avatar
    Permalink to comment#


  3. User Avatar
    Permalink to comment#

    Useful snippet, thanks!

  4. User Avatar
    Permalink to comment#

    where do yo place this function?

  5. User Avatar
    Permalink to comment#

    I’ve been using:

    function new_excerpt_more($more) {
    global $post;
    return ‘… a class=”more-link” href=”‘. get_permalink($post->ID) . ‘”>’ . ‘Read More »’ . ‘/a’;
    add_filter(‘excerpt_more’, ‘new_excerpt_more’);

    But it kept showing the ” … ” at the end of the post.
    This is much cleaner. Thanks!

  6. User Avatar
    Permalink to comment#

    Thank you for all your tricks, you save us so much time!

    Any impact on SEO when using this one please?


  7. User Avatar
    Permalink to comment#

    Hey mate,

    Thank’s a lot for sharing this ,but I have a little problem…
    I have a website ( and on the main page, there is a huge padding from the text to the “Read more…” .

    Is there any way to solve that, and if yes , how ?

    Regards, Altin

  8. User Avatar
    Permalink to comment#

    that didn’t work in my theme, till I wrote this:

    <?php function replace_excerpt($content) {
    return str_replace('[&hellip;]', '... ', $content );

    because &hellip is the appropiate HTML entity

    • User Avatar
      Permalink to comment#

      Thanks! The combination of the snippet above and the &hellip worked. Saved me time, thanks Alex.

      And thanks CSS-Tricks, this site is often invaluable.

    • User Avatar
      Joel Kumwenda

      Thanks Alex this worked for me.

  9. User Avatar
    Sarah Lewis (@WPMoxie)
    Permalink to comment#

    I’ve updated this to work with HTML entities but still be backwards-compatible. See the Gist.

Leave a Comment

Posting Code!

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.