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
Elegant Themes
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. Stephanie LH Calahan says:

    I am using the most recent Genesis Prose theme. It does not automatically add an excerpt link of any kind and does not show [...] I am using the excerpt field from the theme not the “more” tag.

    How would I add that link to an excerpt? Much gratitude in advance.

  2. Adriano says:

    Thank you! Although it would be fair to add 2 things:

    - In writing the article does not insert the “more”
    - In the index.php file not enter “the_content ();” but “the_excerpt ();” (could be granted, but in many themes use the_content)

    Now if someone responds to my question would be grateful:
    the preview on the main page of the items you can have them all of 5 lines?

    • WPBeginner Support says:

      Adriano if a theme uses the_content and there is not more tag in the articles. Then your only choice is to replace the_content tag with the_excerpt in the theme templates where you want to show the excerpts. Another way of doing this is by using the_content filter and modifying it into excerpt length but that’s a little complicated solution.

      • mai says:

        Hello sir
        please, I have just changed my theme, and I got some issues, was googling and trying but really didnt get it yet.
        I used to have READ MORE by defult in my previous theme, not it shows ALL posts
        how can I add it by defult like before? am not VERY technichal but i can do easy things
        i want it to show few lines and photo then says read more

        another thing is all my pages which has comments, it doesnt show any of them! I can see the comments and I checked Add comments it is there, but nothing shows in the page

        please advice

        thanks a looooooot

  3. Thomas says:

    is there any plugin that can add another button

    So besides “Read more” button alone, I want to add another button on the left like “Visit Website”

  4. Ishan says:

    I am a newbie when it comes to wordpress. I tried pasting the code in the beginning Iconic One wordpress theme in functions.php. It didn’t work, rather the code started showing up on the blog. I am not familiar with coding at all. Kindly help

    • WPBeginner Support says:

      ishan try posting it immediately after <?php tag or at the end of your functions.php file just before the ?^gt; tag. you may not have it at the end of your functions.php file but if you do, then paste the code before it.

  5. shini says:

    i added readmore in website how can i change the colour of read more to blue

    • WPBeginner Support says:

      in the above code add a css class to your read more link. Like this:
      <a href="'. get_permalink($post->ID) . '" class="readmore" >' . 'Read More »' . '</a&gt';

      Then use CSS to modify the read more link

  6. Andi says:

    Thank you :D This helped me solve a problem I only now realized I had. I think I’ve had this problem for years now, but never noticed. Nor did anyone complain.

  7. Toni says:

    Thanks it worked like Magic

  8. Nicole says:

    Hello. I edited the Twenty Twelve: Theme Functions (functions.php) as per the above article’s code and saved it the first time and it stated File edited succesfully. However when I edited it again, this fatal error message came up.

    Fatal error: Cannot redeclare new_excerpt_more() (previously declared in /home/content/70/9739270/html/wp-content/themes/twentytwelve/functions.php:443) in /home/content/70/9739270/html/wp-content/themes/twentytwelve/functions.php on line 463

    Can you please help?

  9. Dustin Green says:

    The “Read More” link isn’t automatically appearing. Do I need to add the code above into the function improved_trim_excerpt($text) of the functions.php?

    • Editorial Staff says:

      This function works with the built-in excerpts only. It seems that you’re using another plugin for your excerpts.

  10. Jenny says:

    thank you for this, been on the hunt for this info for a couple of hours…

  11. Sarra Munro says:

    Ok, please take in to consideration that I am waaaay out of my comfort zone building websites. Please don’t baffle me!
    Can I add a ‘read more’ on to a featured slider on my home page?

  12. Rica says:

    Will this work for a category.php page? If so where do I insert it?

  13. Janel from NellieBellie says:

    Awesome!! Worked like a charm!

  14. Jay says:

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

  15. Matej says:

    tnx!! that work for me!! ;)

  16. 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

  17. 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.

  18. Salu says:

    Thanks alot. Problem solved

  19. Bhumit says:

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

  20. Mia says:

    @wpbeginner That worked! Thanks for the answer!

  21. 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.

  22. 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?

  23. wpbeginner says:

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

  24. Ibadullah says:

    Not working for me :(

  25. 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

  26. AshutoshJoshi says:

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

  27. AshutoshJoshi says:

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

  28. Steve says:

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

  29. 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.