WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Excerpt

The WordPress Excerpt is an optional summary or description of a post; in short, a post summary.

The Excerpt has two main uses:

  1. It replaces the full content in RSS feeds when the option to display summaries is selected in Dashboard › Settings › Reading.
  2. Depending on the WordPress theme, it can be displayed in places where quick summaries are preferable to full content:
    • Search results
    • Tag archives
    • Category archives
    • Monthly archives
    • Author archives

Contents

How to add excerpts to posts

To add an excerpt to a post, simply write one in the Excerpt field under the post edit box. An excerpt can be as short or as long as you wish. Usually, given its purpose, a couple of sentences is fine. If adding the excerpt manually, you may use (some) HTML formatting and the tags will not be stripped.

Note: As of WordPress version 3.1, some screen options on the Post & Page edit Administration Panels are hidden by default. The Excerpt field is hidden by default if it has not been used before.

Interestingly, since the WordPress excerpt is similar in purpose to the META description of (X)HTML documents, excerpts can additionally be used as meta descriptions too. Some themes do this by default. It can also be done by means of an SEO plugin or a plugin for managing data in the head of (X)HTML pages.

How to add a link beneath an excerpt to the full post

When using the excerpt feature WordPress does not automatically provide a link to a page containing the full post. To generate a link include the following code in the loop directly below <?php the_excerpt(); ?>

<a href="<?php echo get_permalink(); ?>"> Read More...</a>

Or put the following in your theme's functions.php.

function excerpt_read_more_link($output) {
 global $post;
 return $output . '<a href="'. get_permalink($post->ID) . '"> Read More...</a>';
}
add_filter('the_excerpt', 'excerpt_read_more_link');

Excerpt, automatic excerpt, and teaser

The manual WordPress excerpt is often confused with the automatic excerpt or with the teaser (the part of a post that appears on the front page when you use the More tag). While both are related to the manual excerpt, they are different from it.

The relationship between the three is this: When a post has no manual excerpt and the post template uses the the_excerpt() template tag, WordPress generates an excerpt automatically by selecting the first 55 words of the post. When the post template uses the the_content() template tag, WordPress will look for the More tag and create a teaser from the content that precedes the More tag.

Resources


This page is marked as incomplete. You can help Codex by expanding it.