WordPress custom excerpt length lets you control how many words show in post summaries. With this quick tweak, you can set a custom excerpt length without any plugin.
Add this to your child theme’s functions.php
file:
function qdt_custom_excerpt_length( $length ) {
return 30; // Change 30 to any number of words you want
}
add_filter( ‘excerpt_length’, ‘qdt_custom_excerpt_length’ );
How It Works
This WordPress custom excerpt length snippet hooks into the excerpt_length
filter. You choose how many words WordPress should show in post summaries or archive pages.
Why WordPress Custom Excerpt Length?
Custom excerpts help you control layout, improve readability and keep grids tidy. Perfect for blog lists, news feeds or custom archives.
Common Mistake
Don’t forget to test how your new length looks on different templates. Some themes override this filter — so check if yours works as expected.
Pro Tip
Pair this with a custom “Read More” link style for even cleaner post teasers.