Skip to main content
WordPress made easy with the drag & drop Total WordPress Theme!Learn More

How to Change The Default Excerpt Length In WordPress

Last updated on:

One of the main reasons to use WordPress for your site is because a lot of your content is automated by your theme and by the WordPress core. One of these advantages is the excerpt function which allows you to show the first “55” words of your post in the archive pages (categories and tags) and the homepage.

But what if you wanted to show more or less then 55 words for  your post excerpts?

One thing you can do is use the built-in “more” function when editing your posts which allows you to specify the exact location for your excerpt or use the excerpt field which allows you to paste a custom excerpt for your posts. Personally I find the custom excerpt field to be one of the best things to use because not only can you set a custom excerpt you can also make it 100% unique to prevent any sort of duplicate content issues on your site and stay in good terms with search engines like Google. But if you already have hundreds or more articles published and want to quickly change the excerpt length so all your post entries are consistant then you probably want to use some code or a plugin for that.

Changing The Excerpt Length For All Loops

Luckily WordPress has a built-in filter appropriately named “excerpt_length” that will allow you to change the default length of your excerpts in your theme. Simply insert the following piece of code into your functions.php file and edit the “20” to the amount of words you want to show in your excerpts.

add_filter( 'excerpt_length', function($length) {
    return 20;

Note: We are using PHP_INT_MAX for the priority to ensure your code overrides WordPress, your theme or any possible plugin that may also be altering excerpt_length.

Alternatively you can can have a look at the Advanced Excerpt free plugin that will allow you to easily customize not only the excerpt length but also tweak things like the read more link, strip out shortcodes, allow html, etc.

Of course both the methods above assume your theme has been coded to make use of the_excerpt function. Many themes (especially premium themes) have their own built-in functions for excerpts to allow for greater control. So if the code above doesn’t work you should contact the developer of the theme you are using and ask how you can tweak the excerpt lengths for your theme.

Custom Excerpt Lengths (for Developers)

For those developers looking to create custom excerpts for your theme or plugin we’ve written a tutorial with a nice custom function you can paste into your project so you can display different excerpt lengths across the site for different archives, post types, etc. Simply visit our post on How to Add Multiple Custom Excerpt Lengths In WordPress to learn more and check out the code.

Subscribe to the Newsletter

Get our latest news, tutorials, guides, tips & deals delivered to your inbox.


  1. Heather

    This is exactly what I was looking for… Thanks!

  2. Edward Chung, PMP

    This post is very useful, thanks a lot!

  3. Paula Montenegro

    Thanks, it worked!

    • Kyla

      That’s great to hear!

Leave a Reply

Your email address will not be published.

Learn how your comment data is processed by viewing our privacy policy here.