WordPress : How to enable missing excerpt for pages & posts

wordpress-missing-excerpt

With excerpts in WordPress, you can have them for both posts and pages, but for pages, the excerpts are disabled by default. Even for posts, they can be hidden inside the post editor or they could be disabled altogether. This article will show you how to fix the issue of missing excerpts and make them visible in posts and how to enable them in the page editor.

What are excerpts

Excerpts are optional text that you can add to individual posts and are displayed as a summary of the posts. They are usually used in an archive or blog index page to avoid showing the whole content of the posts.

If the excerpt metabox field for the post is empty, then by default, WordPress will automatically generate it from the post content by taking the first 55 words of the post.

Excerpts and Themes

Some themes don't make use of them at all. If the theme is using the_content() and not the_excerpt() method inside archive or blog index page, then the theme does not use them.

In those cases, where theme uses the_content(), the theme will rely on <!--more--> quicktags in the posts and will use this as a cutoff point to show only part of the post that appears before <!--more-->.

So, one benefit of using the excerpt is that you don't need to insert the <!--more--> quicktags on every post you make.

Now that we know what excerpts are, let's see how to use them.

Excerpts for posts using a default WordPress editor (Gutenberg)

For the default WordPress editor, the excerpt field can easily be found on the right sidebar of the editor.

wordpress - gutenberg post editor excerpt

Click image to enlarge

But what to do, if you don't see this field? It can just be hidden, so we need to enable it back by doing the following:

  1. Click on the "Show more tools and options" button, which is the icon with three dots located at the top right corner:

    wordpress gutenberg post editor options - missing excerpt field - enabling it back using three dots options button

    Click image to enlarge
  2. Next, select the "Options" as shown here:

    wordpress gutenberg post editor options

    Click image to enlarge
  3. The popup window with various options should show up. Add check to "Excerpt" checkbox as shown below:

    wordpress gutenberg post editor options - enable excerpt

    Click image to enlarge

There is a possibility, that you won't have an Excerpt checkbox at all. In this case, look at this section of this article, on how to proceed.

Excerpts for posts inside Classic Editor

In case you are using Classic Editor plugin and the classic editor is enabled, you might also notice the missing excerpt field and again, same as with Gutenberg editor, it probably just means it is hidden. We can show the meta box field 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 fields. Add a checkbox for the "Excerpt" field:

    wordpress classic post editor - screen options excerpt checkbox

    Click image to enlarge
  • Now, you should see the excerpt meta box below the main content editor:

    wordpress classic post editor - excerpt metabox field

    Click image to enlarge

When post options is missing excerpt checkbox

Sometimes, you might notice the missing Excerpt checkbox inside "Options" (either using Classic editor or Gutenberg), so there will be no way to make them visible in the post editor. In that case, you most probably have a code in the theme that removes the excerpt feature. In your theme, open functions.php and look for the code that looks something like this:

add_action( 'init', 'my_custom_init' );
function my_custom_init() {
	remove_post_type_support( 'post', 'excerpt' );
}

Simply comment out the remove_post_type_support() line and check the Screen Options again.

Adding excerpts for pages

By default, the pages will have a missing excerpt meta box field and there will also be no option for the "Excerpt checkbox" inside “Screen Options”, because the excerpt functionality in page editor is disabled. Luckily, there is a way to enable them back. Here are two ways to do this:

Solution 1 – Add excerpt by installing a plugin

The simplest way to have an excerpt editor for the pages is to install an appropriate plugin. Even though, there are many plugins available for this task, most of them are old and not maintained anymore. Even the most current plugin I found Excerpts for Pages is 2 years old. Due to this, I suggest trying to add the necessary code manually, which is shown next.

Note: If you know of any newer plugin that enables excerpts in pages, let me know and I might add it in this article.

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.

Conclusion

Sometimes, when you want to use excerpts in WordPress, you might notice that the excerpt metabox field is missing in the post editor. In this article, we examined, how to enable them back and we also learned, how to enable them for pages, as by default, they have no excerpts at all.

Write a Comment

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