How to Change Excerpt Length in WordPress

Function the_excerpt() can be used to show summary of article or post in WordPress. As default, the excerpt length is set to 55 words. We can control this length by adding few lines code in functions.php file inside theme folder.

Below is the codes to change excerpt length in WordPress.

Open File Manager and open your functions.php inside theme folder which is currently used.

After that, add these lines of code at the end of the file:

function custom_excerpt_length( $length ) {
return 8;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

Above code will change excerpt length to 8 words (return 8). You can modify this number as you like.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.