Change the default excerpt length of 55 words.

By default the_excerpt length is 55 words. Sometimes I want to give my readers a longer excerpt length, depending on font-size and other element sizes, you could make the little teaser somewhat longer.

The below code creates overwrite the_excerpt and will return as many words as you desire.

function new_excerpt_length($length) { 
    return 100;

add_filter('excerpt_length', 'new_excerpt_length');

Change the “100” to as much or as little as you want!

Leave a comment

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