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.







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:
// Changing excerpt more function new_excerpt_more($more) { global $post; if (is_home()) { return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More »' . '</a>'; } else { return 'more...'; } } add_filter('excerpt_more', 'new_excerpt_more');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 »' . '</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
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?