Ever wondered, “what is a WordPress excerpt?” In this entry, we’re going to get into anything and everything related to WordPress excerpts. By the end, you’ll know:
There’s a lot to cover, so let’s get started!
What is a WordPress Excerpt?
A WordPress excerpt is basically a summary of a longer article, often used as a replacement on the blog index and archives pages to avoid needing to display the full content of each post.
For example, displaying the full content for 10 posts that are 1,000 words each means that your blog listing pages will contain ~10,000 words, which is an unmanageable wall of text for most users.
Excerpts allow you to slim this down by showing short summaries instead of the full text of each post:
Do All Themes Display Excerpts?
Whether or not a theme displays excerpts is entirely up to the theme developer. The WordPress software includes built-in functionality to handle excerpts – but not all themes make it easy to take advantage of this functionality.
Later in this post, we’ll discuss a way in which you can try to force your theme to display post excerpts instead of full content.
How Are WordPress Excerpts Generated?
There are two potential methods for WordPress to generate excerpts for your posts:
- Automatically – by default, WordPress generates excerpts by simply selecting the first 55 words of a post.
- Manually – with a minor tweak, you can manually edit the text to use for each post’s excerpt.
The advantage of the manual method is that you’re not limited to just the text at the beginning of a post – you can create a full summary if you’d like.
How to Enable Manual Excerpts in WordPress Editor
To enable manual excerpts in the WordPress Editor, create a new post like normal by going to Posts → Add New.
Then, click the Screen Options button in the top-right corner of the interface:
In the slide-down menu that opens, check the box for Excerpt:
Now, when you scroll down in the WordPress Editor, you should see a new meta box named Excerpt:
You can enter your own manual excerpt in this box. It won’t affect your regular post content – just the excerpt generated by your theme.
How to Make Your Theme Display Excerpts
As discussed, some themes give you an option in the theme settings to display excerpts on your blog index pages.
These options are usually contained in either:
- The WordPress Customizer
- A custom theme settings panel
If your theme doesn’t offer such an option, you can still force it to use excerpts by manually editing the theme template files.
While the code change is simple, this is still somewhat of an advanced method – if you don’t feel comfortable editing your theme’s template files directly, click here to learn how to use the “More” tag to create something almost identical to excerpts without needing to edit any theme files.
How to Edit A Theme’s Code to Make It Display Excerpts
Note – this guide will not apply to all themes. Many themes break apart their code into different parts. Without a basic understanding of the WordPress loop, you may struggle to make these changes.
Before editing any theme code, ensure that you’re following best practices by:
Once you’re set up, the best place to start is by editing these files:
- Index.php
- Archive.php
- Category.php
Look for this code snippet:
<?php the_content(); ?>
All you need to do is replace that snippet with this snippet:
<?php the_excerpt(); ?>
Save your changes and that’s it!
Again – you might not see the_content() in these files, or you might not even see these files at all. If you don’t, you may need to ask a professional for help.
How to Manually Change the Length of Excerpts
If you want to change the length of the excerpts displayed by your theme, you can use the excerpt_length filter in your child theme’s functions.php file.
Here’s an example of the code that you can add to functions.php:
/**
* Filter the excerpt length to 20 words.
*
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
function wpdocs_custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 );
Change the number 20 to the actual number of words that you want your excerpts to contain.
How to Enable Excerpts for WordPress RSS Feed
By default, anyone who subscribes to your RSS feed will be able to read your entire post via RSS. If you’d prefer to only give them an excerpt via RSS, you can easily enable this via your WordPress dashboard.
Go to Settings → Reading. Under For each article in a feed, show, make sure to check the Summary box and save your changes:
How to Use the “More” Tag in Place of Excerpts
Many WordPress users confuse the “More” tag that’s part of the WordPress Editor toolbar as an excerpt. While the end result is often similar, WordPress technically considers this a teaser, rather than a true excerpt.
Still, the “More” tag does function quite similarly in terms of end results and offers a unique advantage over the excerpt system:
The “More” tag still lets you display a summary without editing your theme’s template files even if your theme doesn’t support excerpts by default.
The only downside is that using the “More” tag only lets you pull content from the beginning of your post.
To use the more tag, place your cursor at the spot where you want to end the teaser and click the “More” button in the WordPress Editor:
You should see a visual representation of the “More” tag in the WordPress Editor.
WordPress will only display the content before the “More” tag on your blog index pages, while each individual blog page will still display the entire text (including the part before the “More” tag).
That wraps up our guide. We hope you learned a bit more about WordPress excerpts, as well as how you can actually use excerpts on your site.
Save time, costs and maximize site performance with:
- Instant help from WordPress hosting experts, 24/7.
- Cloudflare Enterprise integration.
- Global audience reach with 34 data centers worldwide.
- Optimization with our built-in Application Performance Monitoring.
All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that’s right for you.