By default, WordPress displays the first 55 words from the post content for the excerpt. But sometimes we need to show more or fewer words. This tutorial shows you how to change the default excerpt length of your theme.
Simply open your functions.php and put this PHP code-
<?php /** * Control excerpt length. */ function custom_excerpt_length( $length ) { return 15; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); ?>
This function where it specifies ‘return 15’ is to change the excerpt length to 15 words. You may change the ‘return’ value to any number as you like.
Tags: