Blog

A simple way to limit words in WordPress Excerpts

April 3, 2017

If you want to limit the number of words that the function called the_excerpt(); displays on your theme, you can add this code in your functions file. This code will basically use the excerpt_length filter and limit the number of words that WordPress generates by default.

function tc_limit_wp_excerpts( $length ) {
 return 25;
 }
 add_filter( 'excerpt_length', 'tc_limit_wp_excerpts', 999 );
Share