Replace Default WordPress Excerpt Ellipsis With Read More Link

News & Community

Add this to your functions.php file. It will replace the default […] at the end of your excerpt with a “Read More →” link.

function replace_excerpt($content) {
return str_replace('[...]',
'<a href="'. get_permalink() .'">Read More →</a>',
$content
);
}
add_filter('the_excerpt', 'replace_excerpt');

Want to Submit a Daily Tip to WPMU DEV?

If you’ve got a great tip for WordPress, WordPress Multisite, or BuddyPress users, send it our way on Twitter: @wpmudev and we’ll happily credit you. Create a tweetable title and let us know if you have more info or an article you’d like to link it to.

All the good WordPress stuff, once every two weeks

Subscribe

Leave a comment