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.

As always, just let me know if you run into any issues at all.

Related Posts:

One Response to “WordPress: How to change the length of blog post excerpts”

  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.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">