Short and Google-friendly title: Changing WordPress’ Default Excerpt Length

Using WordPress for your website has many advantages, one of which is the automated content management system provided by the theme and the WordPress core. One such advantage is the excerpt function, which allows you to display the first 55 words of your post on archive pages (categories and tags) and the homepage. However, what if you want to show more or less than 55 words for your post excerpts?

There are a few ways to achieve this. One way is to use the built-in “more” function when editing your posts, which allows you to specify the exact location for your excerpt. Another way is to use the excerpt field, which allows you to paste a custom excerpt for your posts. The custom excerpt field is particularly useful because it allows you to create a unique excerpt that can help prevent duplicate content issues on your site and improve your search engine rankings.

If you have hundreds or more articles published and want to quickly change the excerpt length so all your post entries are consistent, you can use some code or a plugin for that. WordPress has a built-in filter called “excerpt_length” that allows you to change the default length of your excerpts in your theme. You can insert a piece of code into your functions.php file and edit the “20” to the amount of words you want to show in your excerpts. This will ensure that your code overrides WordPress, your theme, or any possible plugin that may also be altering excerpt_length.

Alternatively, you can use a free plugin called Advanced Excerpt that allows you to easily customize not only the excerpt length but also tweak things like the read more link, strip out shortcodes, allow HTML, etc. However, both methods assume that your theme has been coded to make use of the_excerpt function. Many themes, especially premium ones, have their own built-in functions for excerpts to allow for greater control. 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.

For developers looking to create custom excerpts for their theme or plugin, there is a tutorial available with a custom function that can be pasted into your project. This allows you to display different excerpt lengths across the site for different archives, post types, etc. Simply visit the post on How to Add Multiple Custom Excerpt Lengths In WordPress to learn more and check out the code.

In conclusion, WordPress provides many options for customizing your post excerpts. Whether you want to show more or less than the default 55 words, there are various ways to achieve this. By using the built-in “more” function, the excerpt field, or a plugin like Advanced Excerpt, you can easily customize your post excerpts to improve your site’s user experience and search engine rankings.

Stay in Touch


Related Articles