How to: Remove the […] from the excerpt

March 13, 2009 at 10:43 am

Did you ever wondered why the the_excerpt() function always display […] at the end of the post excerpt? To be honest, I don’t find this very beautiful. So, what about remove it? Just read on.

To get rid of the […] at the end of the post excerpt, simply paste the following function in the functions.php file from your theme:

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

And you’re done! Goodbye […] :)

By the way, I recently started a contest on Cats Who Code, where you can win premium WordPress themes. Sounds good to you? Click here to join.