How to Remove the suffix dots in WordPress post excerpt endings?

The WordPress Excerpt is an optional summary or description of a post; in short, a post summary. After published your post, the excerpt will be display in RSS feeds (if you choose it’s not display your full post), Search results, Tag archives, Category archives, Monthly archives and Author archives. Don’t confused between excerpt and teaser (the part of a post that appears on the front page when you use the More tag). While both are related to the manual excerpt, they are different from it.

By default wordpress, automatically adds the  […] to while clipping the excerpt extra data. This you will notice in the homepage when the blog posts show up.  Personally, i dont like this and i always fix this by replacing [..] to something like either remove it or with couple of dots. Here is the snippet of this code, which fixes it and you have to copy and paste it in your theme functions.php

/******************* Excerpts fix ***************/
add_filter('excerpt_more', 'new_excerpt_more');
function new_excerpt_more( $more ) {
 return '';

Or if you want that […] to became just … You can add this:

function trim_excerpt($text)
    return str_replace(' [...]', '...', $text);
add_filter('get_the_excerpt', 'trim_excerpt');

Might be you want to change the dots with a read more link to the article. Than you can add this code:

function trim_excerpt($text)
    return str_replace(' [...]', '<a href=' . get_permalink() . '>' . ' read more...</a>', $text);
add_filter('get_the_excerpt', 'trim_excerpt');

That’s all.!

0 0 vote
Article Rating
Notify of
1 Comment
Inline Feedbacks
View all comments
9-Blog - Security Discussion

Thank you for publishing this awesome article. I’m reading your blog since a long
time already but I never compelled to leave a comment.
I saved your blog in my rss feed and shared it
on my Facebook. Thanks again for this great article!

Would love your thoughts, please comment.x