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 »
  • Stephanie LH Calahan

    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.

  • Adriano

    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?

    • http://www.wpbeginner.com/ WPBeginner Support

      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

        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

  • Thomas

    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”

  • Ishan

    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

    • http://www.wpbeginner.com/ WPBeginner Support

      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.

      • Jason K

        I tried this and it isn’t doing anything… There’s still no read more button.

  • shini

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

    • http://www.wpbeginner.com/ WPBeginner Support

      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

  • Andi

    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.

  • Toni

    Thanks it worked like Magic

  • Nicole

    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?

  • Dustin Green

    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?

    • http://www.wpbeginner.com Editorial Staff

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

  • Jenny

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

  • Sarra Munro

    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?

  • Rica

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

    • http://www.wpbeginner.com Editorial Staff

      Yes it will work. You would need to insert this inside your loop.

  • Janel from NellieBellie

    Awesome!! Worked like a charm!

  • Jay

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

    • http://www.wpbeginner.com Editorial Staff

      TwentyTwelve definitely has a functions.php file.

  • Matej

    tnx!! that work for me!! ;)

  • Nik Cree

    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?

    • http://www.wpbeginner.com Editorial Staff

      Did you try using is_front_page?

      • Nik Cree

        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.

        • http://www.wpbeginner.com Editorial Staff

          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

        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

  • shlemberg

    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.

    • http://www.wpbeginner.com/ wpbeginner

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

      • shlemberg

         @wpbeginner
        Problems solve!
        I can apply it from  the them options.
         
        Thank you.

  • http://articlesposting.com/ Salu

    Thanks alot. Problem solved

  • http://saynotohollywood.com/ Bhumit

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

  • Mia

    @wpbeginner That worked! Thanks for the answer!

  • wpbeginner

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

  • Mia

    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?

  • wpbeginner

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

  • Ibadullah

    Not working for me :(

  • summerdavis

    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

  • AshutoshJoshi

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

  • AshutoshJoshi

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

  • http://www.hawkinsspringsfarm.com Steve

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

  • http://www.vitmeldesign.com vitmel

    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.

    • http://techwithease.com/ Benjamin Altman

      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?