How to reduce the default length of a post excerpt in WordPress

Saul Goodman May 19, 2019 Loading...

The default length of the post excerpt in WordPress is 55 words. This seems too long if you display over 5 posts on the homepage, blog page or category page. Luckily, you can easily change the excerpt length with a few lines of code.

Add the following code to your functions.php file:

 function my_theme_excerpt_lenght( $length )
    return 25; 
    //you can use 25 or whatever number you like
add_filter( 'excerpt_length', 'my_theme_excerpt_length' );

  • Tag
  • avatar
    Welcome to KINDACODE. Have a nice day and code well!