WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
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

WPBeginner» Blog» Tutorials» How to Display a Read More link in WordPress Excerpts

How to Display a Read More link in WordPress Excerpts

Last updated on November 27th, 2012 by Editorial Staff
47 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
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.

47 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

65 Comments

Leave a Reply
  1. dhruv rajhans says:
    May 19, 2020 at 3:32 am

    thanx for help i just love you

    Reply
    • WPBeginner Support says:
      May 19, 2020 at 9:43 am

      Glad you like our content :)

      Reply
  2. Rakesh says:
    May 12, 2020 at 11:33 pm

    My WordPress seach results shows posts and pages also. How do I make sure read more link is shown to page excepts also. The above code works only for posts. Any help greatly appreciated.

    Reply
    • WPBeginner Support says:
      May 13, 2020 at 9:03 am

      For adding excerpts to your pages you may want to take a look at our guide below:
      https://www.wpbeginner.com/plugins/add-excerpts-to-your-pages-in-wordpress/

      Reply
  3. Manu De Mey says:
    Feb 22, 2018 at 9:47 am

    This article explaines how to REPLACE the […] with a “read more” link.

    This article does not explain how to add a link when there is none in the theme you are using (there is not even a […] link in the theme I am using).

    Therefore, the title of this article “How to Display a Read More link in WordPress Excerpts” is misleading and wrong.

    Reply
    • WPBeginner Support says:
      Feb 22, 2018 at 5:31 pm

      Hi Manu,

      Please take a look at our guide on how to customize excerpts in WordPress with no coding required.

      Reply
  4. Moin says:
    Oct 20, 2017 at 12:20 pm

    Not working in Zerif Lite theme. Please help me.
    WP version: 4.8.2
    Zerif Lite version: 1.8.5.29

    Reply
  5. Ehtisham says:
    Sep 30, 2017 at 7:26 am

    Hi there i want to Insert some Reference button right before read more but i’m unable to do that
    Is there anyway to do so?

    Reply
  6. Jahangir Khan says:
    Aug 3, 2017 at 5:33 am

    Thanks a lot, It worked perfectly.

    Reply
  7. Hairul Hissam says:
    Jan 13, 2017 at 5:15 am

    very useful. thanks a lot..

    Reply
  8. Sarah says:
    Jul 21, 2016 at 9:34 am

    Hi, this has worked great but I’d really like the Read More link to appear as a new paragraph below the excerpt – how do I make it do that? Thanks in advance.

    Reply
  9. Stuart says:
    May 18, 2016 at 7:31 am

    Thank-you SO much! The first smooth and straight-forward bit of help I’ve had so far!

    Reply
  10. abhay says:
    Jan 1, 2016 at 2:50 pm

    isn’t it lead to duplicate content , and it not tell me how to do manual , becoz i dont know coding and purchasing new themes

    Reply
  11. Bhargav Gupta says:
    Jan 29, 2015 at 5:13 am

    Hey, the read more link is appearing on only the first post on the homepage. It’s not being shown on the other posts except the first one. What might be the issue?

    Reply
  12. WPBeginner Staff says:
    Jan 14, 2015 at 3:08 pm

    Make sure you are adding this code in your theme’s functions.php file which is located in /wp-content/themes/your-theme-dir/functions.php

    Reply
  13. Manoj4020 says:
    Jan 12, 2015 at 12:38 pm

    Hey I am new to wordpress. I tried to paste the code in functions.php. then i am getting this
    Fatal error: Call to undefined function add_filter() in /opt/lampp/htdocs/wordpress/wp-includes/functions.php on line 7

    Reply
  14. Jared Olson says:
    Nov 9, 2014 at 3:56 pm

    Code worked great. I also added the <a class=”more-link” to it so it keeps the styling of my read more button. Code is:

    // Changing excerpt more

    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’);

    Thanks for the great article.

    Reply
  15. Kathleen Garber says:
    Aug 4, 2014 at 9:03 am

    Thank you so much!

    Reply
  16. Jeremy Wallace says:
    Jul 29, 2014 at 1:51 pm

    This is… EXACTLY what I was looking for.. THANKS! It should be like that by default instead of […]. Again, thanks a ton for this article. I can now finish my build haha

    Reply
  17. Stephanie LH Calahan says:
    Jan 25, 2014 at 8:33 pm

    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.

    Reply
  18. Adriano says:
    Nov 8, 2013 at 6:36 am

    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?

    Reply
    • WPBeginner Support says:
      Nov 8, 2013 at 1:24 pm

      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.

      Reply
      • mai says:
        Jan 28, 2014 at 3:28 pm

        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

        Reply
  19. Thomas says:
    Oct 20, 2013 at 11:49 pm

    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”

    Reply
    • WPBeginner Support says:
      Oct 21, 2013 at 12:19 pm

      It can be done using the excerpt_more filter in your theme’s functions.php see how to change the read more link in WordPress excerpts.

      Reply
  20. Ishan says:
    Oct 17, 2013 at 8:55 am

    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

    Reply
    • WPBeginner Support says:
      Oct 21, 2013 at 7:18 pm

      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.

      Reply
      • Jason K says:
        Dec 17, 2013 at 2:16 pm

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

        Reply
  21. shini says:
    Oct 13, 2013 at 1:53 am

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

    Reply
    • WPBeginner Support says:
      Oct 13, 2013 at 6:25 pm

      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

      Reply
  22. Andi says:
    Oct 5, 2013 at 6:16 am

    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.

    Reply
  23. Toni says:
    Sep 24, 2013 at 6:32 am

    Thanks it worked like Magic

    Reply
  24. Nicole says:
    Sep 9, 2013 at 7:27 am

    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?

    Reply
    • Editorial Staff says:
      Sep 9, 2013 at 8:34 am

      Hi Nicole,

      This tutorial should help:

      https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/

      Reply
  25. Dustin Green says:
    Sep 3, 2013 at 2:16 pm

    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?

    Reply
    • Editorial Staff says:
      Sep 3, 2013 at 3:05 pm

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

      Reply
  26. Jenny says:
    Aug 23, 2013 at 1:03 pm

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

    Reply
  27. Sarra Munro says:
    Jul 18, 2013 at 10:36 am

    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?

    Reply
  28. Rica says:
    Jun 19, 2013 at 4:29 pm

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

    Reply
    • Editorial Staff says:
      Jun 27, 2013 at 9:49 am

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

      Reply
  29. Janel from NellieBellie says:
    May 21, 2013 at 3:24 pm

    Awesome!! Worked like a charm!

    Reply
  30. Jay says:
    Mar 23, 2013 at 12:30 pm

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

    Reply
    • Editorial Staff says:
      Mar 26, 2013 at 8:06 am

      TwentyTwelve definitely has a functions.php file.

      Reply
  31. Matej says:
    Feb 20, 2013 at 5:05 am

    tnx!! that work for me!! ;)

    Reply
  32. Nik Cree says:
    Jan 26, 2013 at 12:26 am

    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?

    Reply
    • Editorial Staff says:
      Jan 28, 2013 at 8:19 am

      Did you try using is_front_page?

      Reply
      • Nik Cree says:
        Jan 30, 2013 at 10:52 pm

        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.

        Reply
        • Editorial Staff says:
          Jan 31, 2013 at 7:02 am

          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:
        Jan 31, 2013 at 4:15 pm

        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

        Reply
  33. shlemberg says:
    Mar 23, 2012 at 2:17 am

    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.

    Reply
    • wpbeginner says:
      Mar 23, 2012 at 6:22 am

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

      Reply
      • shlemberg says:
        Mar 23, 2012 at 6:26 am

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

        Reply
  34. Salu says:
    Feb 17, 2012 at 9:17 am

    Thanks alot. Problem solved

    Reply
  35. Bhumit says:
    Dec 20, 2011 at 8:14 am

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

    Reply
  36. Mia says:
    Sep 7, 2011 at 3:52 am

    @wpbeginner That worked! Thanks for the answer!

    Reply
  37. wpbeginner says:
    Sep 6, 2011 at 11:02 am

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

    Reply
  38. Mia says:
    Sep 6, 2011 at 10:40 am

    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?

    Reply
  39. wpbeginner says:
    Aug 16, 2011 at 11:44 am

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

    Reply
  40. Ibadullah says:
    Aug 15, 2011 at 4:59 pm

    Not working for me :(

    Reply
  41. summerdavis says:
    Jul 11, 2011 at 10:07 am

    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

    Reply
  42. AshutoshJoshi says:
    May 29, 2011 at 10:01 am

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

    Reply
  43. AshutoshJoshi says:
    May 29, 2011 at 10:00 am

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

    Reply
  44. Steve says:
    Mar 7, 2011 at 9:21 pm

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

    Reply
  45. vitmel says:
    Nov 10, 2010 at 5:01 pm

    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.

    Reply
    • Benjamin Altman says:
      Dec 18, 2011 at 4:13 pm

      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?

      Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
MonsterInsights
MonsterInsights
Google Analytics made easy for WordPress. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
Advanced Coupons
Advanced WooCommerce Coupons
Get 50% off the Advanced Coupons smart coupons plugin for WooCommerce.
ProfilePress
ProfilePress Coupon
Get 20% OFF on ProfilePress WordPress ultimate user and profile plugin.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.