Excerpt Length Filter (excerpt_length) Reference to Limit Excerpt Length in WordPress. By default excerpt length is set to 55 words in WordPress. Use this excerpt length filter to change excerpt length to 20 words. Add the code in functions.php file of your theme.

// Filter except length to 20 words.
function modeltheme_custom_excerpt_length( $length ) {
	return 20;
}
add_filter( 'excerpt_length', 'modeltheme_custom_excerpt_length', 999 );

To use this filter in your blog archive, you need to replace “the_content()” function with “the_excerpt()” or:

echo get_excerpt();

Was this post helpful?

Tags: ,