Change WordPress Excerpt Length

The default WordPress excerpt length is set to 55 words by default. Luckily to change this, you’ll only need to post this snippet in your Functions.php file located in your WordPress theme folder ( i.e. /wp-content/themes/mytheme/ ).

In this example, we’ll have the default excerpt length from 55 to only 25 words using this filter:

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

This way, you can put WordPress post excerpts into things such as Bootstrap Cards, or other areas where you may need a much smaller automated post description.