How to add the excerpt box for pages in WordPress

July 27, 2011

By default, the WordPress post editor has an excerpt box that helps you add a little description to your posts. However, this option is not enabled by default for pages, so here’s the solution to that problem.

Add an excerpt meta box to pages

Pre-WordPress 3.0

The best way to add a meta box for pages in WordPress installs older than 3.0 is via the add_meta_box() function.

The code above tells WordPress to use the same “post_excerpt_meta_box()” callback function it employs to add the excerpt box for regular posts, to enable for pages as well.

WordPress 3.0 and up

WordPress 3.0 formally introduced support for new custom post types, which allow you to add custom content types besides the default “post” and “page” types. Along with this, the add_post_type_support() function was added to allow us to tell WordPress what “default” features we want a specific post type to support. Fortunately, we can use this to further extend the default “page” post type as well, such as adding an excerpt box to it.