WordPress: How to change the length of blog post excerpts

Here is the line of code that I use to change the default length (55 words) of excerpts in WordPress.

Copy and paste this snippet into your functions.php file:

function new_excerpt_length($length) {
	return 20;
add_filter('excerpt_length', 'new_excerpt_length');

Simply change the number “20” in the example above to the number of words that you want to display in excerpts.

1 Comment

  1. Melanie says:

    Hi Libby, this is a nice trick 🙂 I’m not a tech woman but I think I can apply this to my blog. Very thanks for sharing.

  2. Comments are closed.