If you make WordPress theme, the chance is you want to change the_excerpt() length and remove/replacing it’s […] suffix:

how to replace the_excerpt suffix

Here’s the easy way to do it using the power of WordPress filters. What we’re going to do is replacing […] with and changing the excerpt’s length into 20 words. This is just an example tho, you can change these into anything you want.

Simply paste this on your functions.php1:

If you need to customize more stuff on the_excerpt(), you can find more filters to be filtered at wp_trim_excerpt() on /wp-includes/formatting.php:2542.


  1. Don’t forget to replace the functions’ prefix tho 

Share Your Thought