How to Limit the Excerpt Length In WordPress Posts

This question came across the PublishPress support desk this week:

Do you know how to set a maximum character length on the excerpt field? I need to be the point of entry, rather than when displaying it on the frontend. I want to force the user to write an excerpt of a certain length.

Yes, this is possible with the PublishPress Checklists plugin. If you need more details, check out our beginners guide to excerpts.

Why Restrict the Excerpt Length

Excerpts are commonly used in theme. You may seem them used on the front page or on “Blog” pages. Any time you don't have space for the whole post, you may want to use a short excerpt.

However, there is no fixed length for WordPress excerpts, and this can be a problem. For example, the user in our support desk had designed a front page with room for a 50 character summary of each post. They needed to make sure their authors entered as close to 50 characters as possible.

When you're writing a WordPress post, the excerpt box is quite small. Visually, you can see 2 or 3 lines of text. However, if your write text to go over 2 lines, WordPress will show a scrollbar for the box. There is no practical limit to the excerpt length.

Scrollbar in a WordPress excerpt

Restrict the Excerpt Length in the Admin Area

First, we'll show to control the excerpt when authors are writing posts. You can force your authors to include an excerpt. You can also control the maximum and minimum number of characters in the excerpt.

You can do this with the PublishPress Checklists plugin.

  • After installing the PublishPress Checklists plugin, go to Checklists > Settings.
  • Scroll down to the “Number of characters in excerpt” row.
  • Choose “Required” from the dropdown.
  • Enter a “Min” and/or a “Max” setting in the right column. In the image below, users must enter between 50 and 60 characters.
  • This will now be one of the items that authors must complete before publishing.
Main PublishPress Checklists screen
Excerpt Max Min

Now when someone goes to write a post, this is what they'll see in the sidebar:

Min Max Excerpt Characters
Min Max Excerpt Characters

If you don't fix this checklist item, it will be impossible to publish the post:

Can Not Publish without fixing checklist items
Can Not Publish Excerpt

Once you have entered the correct number of characters, the red X will turn into green check mark. You can publish this post.

Green Check Excerpt
Green Check Excerpt

Hopefully this tutorial helps you control the excerpts on your site. It is also possible to add code to the front of your site site automatically cut your excerpts at a certain length. However, that also risks creating excerpts that don't make sense because of missing words. This approach we've outlined will ensure that every post on your site has a high-quality excerpt.

The Checklists plugin is full of useful features like this. For example, it can also help you check for broken links in your post or allow you to get client approval.

  • Steve Burge

    Steve is the founder of PublishPress. He's been working with open source software for over 20 years. Originally from the UK, he now lives in Sarasota in the USA. This profile is generated by the PublishPress Authors plugin.

Leave a Reply

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