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 »' . '</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.
thanx for help i just love you
Glad you like our content
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.
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/
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.
Hi Manu,
Please take a look at our guide on how to customize excerpts in WordPress with no coding required.
Not working in Zerif Lite theme. Please help me.
WP version: 4.8.2
Zerif Lite version: 1.8.5.29
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?
Thanks a lot, It worked perfectly.
very useful. thanks a lot..
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.
Thank-you SO much! The first smooth and straight-forward bit of help I’ve had so far!
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
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?
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
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
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.
Thank you so much!
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
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.
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?
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.
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
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”
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.
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
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.
I tried this and it isn’t doing anything… There’s still no read more button.
i added readmore in website how can i change the colour of read more to blue
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>';
Then use CSS to modify the read more link
Thank you
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.
Thanks it worked like Magic
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?
Hi Nicole,
This tutorial should help:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/
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?
This function works with the built-in excerpts only. It seems that you’re using another plugin for your excerpts.
thank you for this, been on the hunt for this info for a couple of hours…
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?
Will this work for a category.php page? If so where do I insert it?
Yes it will work. You would need to insert this inside your loop.
Awesome!! Worked like a charm!
I don’t have a functions.php file in my theme. I’m using the twentytwelve theme.
TwentyTwelve definitely has a functions.php file.
tnx!! that work for me!!
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?
Did you try using is_front_page?
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.
Try doing it this way:
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:
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
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.
@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.
@wpbeginner
Problems solve!
I can apply it from the them options.
Thank you.
Thanks alot. Problem solved
If post contain Image than can it appear at homepage or not?
@wpbeginner That worked! Thanks for the answer!
@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.
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?
@Ibadullah the code should work because we have it running on quite a few sites.
Not working for me
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
how can i make any background color for “Read more” text? Just as I saw in your blog?
how can i make any background color for Read more? Just as I saw in your blog?
I just finished putting your code in today on a site and it does the trick perfectly Thanks
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.
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?