Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Display a Read More link in WordPress Excerpts

Last updated on by
BlueHost - Recommended WordPress Hosting
How to Display a Read More link in WordPress Excerpts

To prevent duplicate content, improve site load time, and for better SEO many bloggers have started to use post excerpts. Excerpts are mini-descriptions of the posts shown on the main blog page, category pages, and archive pages. You can see a live example by visiting any of our categories. But if you notice, our read more button is added on a separate line from the excerpt text. In this article, we will show you how to automatically add a read more link in WordPress Excerpts.

First open your functions.php file, and paste the following code inside the php tags:

 // Changing excerpt more
    function new_excerpt_more($more) {
    global $post;
    return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More &raquo;' . '</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

In this function, you are telling WordPress to remove the default more which looks like this: [...], and replace it with a link. This short and simple tutorial was requested via our suggestion form. You can suggest article ideas as well by using our suggestion form or our twitter @wpbeginner.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Janel from NellieBellie says:

    Awesome!! Worked like a charm!

  2. Jay says:

    I don’t have a functions.php file in my theme. I’m using the twentytwelve theme.

  3. Matej says:

    tnx!! that work for me!! ;)

  4. Nik Cree says:

    I am tying to change add the more link only to the home page using is_home() but can’t achieve this. What is the best way to add the excerpt_more to posts only on the home page?

    • Editorial Staff says:

      Did you try using is_front_page?

      • Nik Cree says:

        Yes I did try is_front_page with no luck either. I used the following in my functions.php:

        //Add Read More Link To Exerpts
        add_filter( ‘excerpt_more’, ‘moogerah_add_excerpt_more’ );
        function moogerah_add_excerpt_more( $more ) {
        if(is_home()) { // also tried is_front_page()
        $more = ‘…Read More‘;
        return $more;
        }}

        Any ideas greatly appreciated.

        • Editorial Staff says:

          Try doing it this way:

          // Changing excerpt more
             function new_excerpt_more($more) {
             global $post;
             if (is_home()) {
             return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More &raquo;' . '</a>';
             } else {
             return 'more...';
             }
          }
             add_filter('excerpt_more', 'new_excerpt_more');
          
      • Nik Cree says:

        Thanks for the alternative but still have the same issue – no ‘read more’ on the home page. However, I have now found that specifying the pages that are displayed on the home page in the conditional argument does work:

        
        // Changing excerpt more
        add_filter('excerpt_more', 'new_excerpt_more');
        function new_excerpt_more($more) {
           global $post;
        if ( is_home() || is_page( array(618, 624, 690)) ) {
           return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More &raquo;' . '</a>';
           } else {
           return ' more...';
           }
        }
        
        

        Not ideal as this line of code would need to be changed every time the pages being displayed on the home page change.

        I can’t see why the ‘is_home()’ does not behave nicely?? Any further ideas at all? Many thanks

  5. shlemberg says:

    Please help!
    I don’t know way but this is not working for me.
    I design temp via Artister, some of WP trick work, and some don’t!
    This code is not working. I really need this to work.
    Any idea?
     Regards.

    • wpbeginner says:

       @shlemberg You should consult with Artister about this issue. The code above is 100% functional. If it doesn’t work with their platform, then there is an issue that needs to be resolved.

  6. Salu says:

    Thanks alot. Problem solved

  7. Bhumit says:

    If post contain Image than can it appear at homepage or not?

  8. Mia says:

    @wpbeginner That worked! Thanks for the answer!

  9. wpbeginner says:

    @Mia The symbol is coming there because you pasted this code into a code-editor like Dreamweaver which didn’t understand the … symbol. Replace the …. with … and it will fix itself.

  10. Mia says:

    Thanks for the Post! But I have a small problem…

    It worked, but I get a question mark symbol before the “read more”-link in every excerpt. How do I remove that?

  11. wpbeginner says:

    @Ibadullah the code should work because we have it running on quite a few sites.

  12. Ibadullah says:

    Not working for me :(

  13. summerdavis says:

    Hi!

    This is great! I have always wanted to have that in my website but I never really had the right code to do it. It will definitely make things more organized. Thank you for sharing this, looking forward for more updates!

    Summer Davis

    Webmaster, <a href=”http://www.artprintsreviewed.com/”>Art Prints</a>

    Pop Art

  14. AshutoshJoshi says:

    how can i make any background color for “Read more” text? Just as I saw in your blog?

  15. AshutoshJoshi says:

    how can i make any background color for Read more? Just as I saw in your blog?

  16. Steve says:

    I just finished putting your code in today on a site and it does the trick perfectly Thanks

  17. vitmel says:

    Hi. I used your code for custom loop for custom page in wordpress and it worked fine, the only thing is that it shows the whole post, “more” link doesn’t work for some reason. I tried the code above and same thing. Maybe you have any suggestions? Thanks for your articles, they are very helpful. If you need more info from me let me know.

    • Benjamin Altman says:

      I think it’s because the article only includes one part of the solution, the piece that goes into the functions.php. The other piece that is needed is here on the wordpress site, read this :http://codex.wordpress.org/Customizing_the_Read_More.

      Hope that helps.

      P.S. For me the solution doesn’t work. After I load the 6 lines of code indicated above in this @wpbeginner beginner article, my WordPress editor goes white every time I click update file…bummer. Any other ways you guys know of?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.