How to enable excerpts for pages in WordPress

If you are a theme or plugin author, you may require additional functionality to allow for additional page content to be added, managed and displayed.

One way this can be achieved, without resorting to custom page meta inputs, is to simply enable support for excerpts on pages.

The excerpt content section that is visible on the post edit screen will then be displayed on the standard page content editing screen.

This can be achieved very quickly and easily by including the following lines in the theme functions.php file:

    // Enable excerpts for pages...
add_action('init', 'enable_page_excerpts');
function enable_page_excerpts()
{
    add_post_type_support('page', 'excerpt');
}

There are a few downsides to using this method, so it is advised that you use with caution.

2 Replies to “How to enable excerpts for pages in WordPress”

  1. Thanks for this! Quick and easy! Works great!

    Sometimes I like to set up an automatic query of child pages of a parent page, so it’s queried like posts, but didn’t have the excerpt feature like posts. It’s a lot easy to use an excerpt for a client, than looping in some text through a custom field.

    Thanks!

Leave a Reply