Change The Post Excerpt Length in WordPress

How to Change The Post Excerpt Length in WordPress

in Posts & pages
Google+ LinkedIn

We already shared how to add excerpt support for pages and change excerpt length for different categories. In this article we will discuss, how to change default value of post excerpt length in WordPress without using a plugin.

The default WordPress excerpt limits your post to 55 words but sometimes 55 words aren’t enough to give a meaningful gist to the content. In such scenarios, you might want to change it to give a better idea to the readers about the post’s content. There are some plugins available in WordPress plugins respiratory that can change post excerpt length but accomplishing this without a plugin is fairly very easy too.

All you have to do is to copy and paste this code snippet into your functions.php file and your post excerpt length will be changed to 75 words instead of default 55 but you can use any number you want.

// change post excerpt length in wordpress
function wcs_excerpt_length( $length ) {
    return 75;
}
add_filter( 'excerpt_length', 'wcs_excerpt_length' );

Share the love

If you like this snippet, share it with others!

Leave a Reply

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