What is Excerpt in WordPress

In WordPress, an excerpt is a short summary or snippet of a post or page content. It provides readers with a preview or teaser of the full content, often displayed on archive pages, blog listings, search results, or widgets. Excerpts improve user experience by giving visitors a quick idea about the content before they decide to read the entire post.

What Exactly Is a WordPress Excerpt?

An excerpt is essentially a condensed version of your post content, usually limited to a few sentences or a specific number of words. It acts like a summary or teaser, helping visitors scan multiple posts and find what interests them.

By default, WordPress generates an automatic excerpt by trimming the first 55 words of your post content (stripping out shortcodes, HTML tags, and other formatting). However, WordPress also allows you to write a manual excerpt to better control what summary appears.

Where Are Excerpts Used in WordPress?

Excerpts are displayed in various places depending on your theme:

  • Blog archive pages showing multiple posts
  • Search result pages
  • Category and tag archive pages
  • Widgets like recent posts or featured posts
  • RSS feeds

Using excerpts helps keep these pages clean and concise, allowing visitors to browse quickly.

How to Add or Edit Excerpts in WordPress

  1. Automatic Excerpts:
    By default, WordPress automatically creates excerpts by cutting off the post content at about 55 words.

  2. Manual Excerpts:
    You can write your own excerpt by editing the post and using the Excerpt box in the post editor sidebar.

    • In the Classic Editor, this box appears below the main editor.
    • In the Block Editor (Gutenberg), open the sidebar settings and find the Excerpt panel.
  3. Enable Excerpts for Pages:
    By default, excerpts are for posts only, but you can enable excerpts for pages by adding this code to your theme’s functions.php:

    add_post_type_support('page', 'excerpt');

Customizing Excerpt Length and More

Developers and site owners can customize how excerpts behave with filters and functions:

  • Change excerpt length (default 55 words) using the excerpt_length filter.
  • Customize the “read more” text or link with the excerpt_more filter.
  • Use the_excerpt() function in templates to display the excerpt.

Example to change excerpt length to 20 words:

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

Why Use Excerpts?

  • Improves readability: Keeps listing pages short and neat.
  • Boosts SEO: Well-crafted excerpts can improve click-through rates in search results.
  • Enhances navigation: Helps users quickly scan and find relevant posts.
  • Customizable: Lets you tailor the summary to highlight the most important parts.

Excerpts in WordPress are a powerful tool to summarize your content, improve user experience, and keep your site’s archive and listing pages clean and easy to navigate. Whether you rely on automatic excerpts or write manual ones, understanding how excerpts work and customizing them can significantly enhance your WordPress site.

FAQs

What exactly is an excerpt in WordPress, and how is it used?
An excerpt in WordPress is a short summary or preview of a post’s full content. It is commonly displayed on blog listing pages, category archives, and search result pages to give visitors a quick overview of what the post is about without showing the entire article. This helps users browse and decide which posts to read in full.

Does WordPress automatically generate excerpts, or do I have to write them manually?
By default, WordPress automatically creates excerpts by taking the first 55 words of a post’s content, stripping out formatting and shortcodes. However, you also have the option to write manual excerpts yourself, which allows you to control exactly what summary appears and can make your listings more engaging and relevant.

How can I add a manual excerpt to a WordPress post or page?
To add a manual excerpt, edit your post or page in the WordPress editor. In the Classic Editor, the Excerpt box is located below the main content area. In the Block Editor (Gutenberg), you’ll find the Excerpt panel in the sidebar settings. Here you can type a custom summary that will be shown instead of the automatic excerpt wherever excerpts are used.

Are excerpts available only for posts, or can they be used with pages too?
By default, WordPress only supports excerpts for posts. However, you can enable excerpts for pages by adding a small snippet of code to your theme’s functions.php file. This lets you create summaries for pages as well, which can be useful if your theme or plugins display excerpts for pages.

Is it possible to change the default length of excerpts in WordPress? If yes, how?
Yes, WordPress lets developers customize the length of automatic excerpts. This is done by adding a function to the excerpt_length filter hook in the theme’s functions.php file. For example, you can set the excerpt length to 20 words instead of the default 55 to create shorter summaries.

What is the difference between the WordPress functions the_excerpt() and the_content()?
the_excerpt() outputs the excerpt or summary of the post content, whether automatic or manual. It’s typically used on archive pages and listings. the_content(), on the other hand, outputs the full post content and is used when displaying the entire post on its single page.

Why should I use excerpts on my WordPress site instead of showing full content everywhere?
Using excerpts improves your site’s readability by keeping archive, category, and search pages concise and easier to scan. It helps visitors quickly identify posts of interest without being overwhelmed by long text blocks. Additionally, well-crafted excerpts can improve SEO by providing relevant summaries that search engines can index more effectively.