How to

Enable Excerpts to Pages and Posts in WordPress

In WordPress, the excerpts for pages is disabled by default, while with posts, they are enabled, but they might still be hidden inside the post editor. This article will show you how to make excerpt editor visible in posts and how to enable excerpts in pages.

Making excerpt in the post editor visible

For posts, when the excerpt editor is missing, it usually just means it is hidden. We can show it with the following steps:

  • Click on “Screen Options” button. It should be located on the top right corner in the post editor:WordPress Screen Options in Editor

  • A window will expand, where we can set the visibility of the various boxes. Add a checkbox for the “Excerpt” box:

    WordPress Screen Options Window - Enabling Excerpt

    Click to Enlarge

If you don’t see the Excerpt option inside “Screen Options“, then you may have a code in the theme that removes that feature. Open functions.php and look for the following code:

remove_post_type_support( 'post', 'excerpt' );

If you find it, remove or comment it out and check the Screen Options again.

Adding page excerpt

The excerpt option inside “Screen Options” will most likely be missing in the page editor, not because it is hidden, but because the excerpt functionality is disabled for them by default. There are two ways to enable them:

Solution 1 – Add excerpt by installing a plugin

The simplest way to have an excerpt editor in pages is to install an appropriate plugin. There are many plugins available for this task, but most of them are old and not maintained anymore. The most current one I found is Excerpts for Pages plugin.

Solution 2 – Add excerpt by adding code

To make excerpts available for pages without the use of the plugin, add the following code inside the functions.php:

function enable_page_excerpt() {
  add_post_type_support('page', array('excerpt'));
}
add_action('init', 'enable_page_excerpt');
Note: To learn, how to register other features for a specific post type, check the add_post_type_support function. To remove a specific feature, check the remove_post_type_support function.

Once the above code is added, we still might need to make the excerpt editor box visible when editing a page. The steps are the same as with posts. Click on “Screen Options” option while in page editor and add a checkbox for “Excerpt” box.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.