Skip to content

WordPress maintenance

WordPress post revisions: how many it keeps, and how to set a limit

In short

WordPress keeps every revision of a post by default, with no upper limit. On our WordPress 7.1.2 test site, one post saved five times after it was created held five revisions, and wp_revisions_to_keep() returned -1, which means keep all. One line in wp-config.php sets a cap.

Key points

  • Out of the box WP_POST_REVISIONS is true, and WordPress turns that into -1, which means store every revision.
  • On our test site one post saved five times held five revisions. Nothing had been set, so nothing was trimmed.
  • Revisions are rows in the posts table, and WordPress has no screen for deleting them.
  • define( 'WP_POST_REVISIONS', 10 ); in wp-config.php caps each post at 10, plus one autosave per user.
On this page (10)
  1. How many post revisions does WordPress keep?
  2. What did our test site keep?
  3. Where are WordPress revisions stored?
  4. Are revisions worth keeping?
  5. How do you limit WordPress post revisions?
  6. Why did the limit not work after I added it?
  7. What happens to the revisions you already have?
  8. What did we not test?
  9. What should you check today?
  10. Questions and answers

How many post revisions does WordPress keep?

WordPress post revisions have no limit until someone sets one. Every time a post or page is saved, WordPress stores the old version as a revision, and by default it keeps all of them.

We checked this on Sunday 11 Oct 2026 on a fresh WordPress 7.1.2 test site. Nothing in wp-config.php touched revisions. We created one post and saved it five more times.

Revisions are one of the quiet things we look at on a site in our WordPress care plan, because they sit in the database and every database backup carries them.

What did our test site keep?

All five. WordPress has a function, wp_get_post_revisions(), that lists the revisions stored for a post. For our test post it returned five.

A second function, wp_revisions_to_keep(), reports the limit for a post. It returned -1.

That -1 is the whole story. The developer reference shows the code: it reads WP_POST_REVISIONS, and if the value is true, it sets the number to -1. The WordPress documentation spells out what -1 means: store every revision. True is the default, so a site where nobody has set anything keeps every save, forever.

Where are WordPress revisions stored?

In the posts table, next to your real posts. The WordPress documentation says revisions are stored as children of the post they belong to, with a post type of revision.

So a page saved 300 times carries 300 old versions in that table. That is an example, not a site we measured.

The same page says there is an API function to delete revisions, “but there is no UI”. You will not find a button in the dashboard that clears them.

Are revisions worth keeping?

Yes, some of them. Each revision is a way back after a bad edit. You open the revisions screen, drag the slider to the version you want and press Restore.

WordPress 7.0 gave that screen a new look. The documentation describes colored markers for blocks that were added, removed or changed, and a Show changes switch that turns the highlights on and off.

The problem is not revisions. It is keeping every one, when nobody needs the 200th oldest copy of a contact page.

How do you limit WordPress post revisions?

One line in wp-config.php:

define( 'WP_POST_REVISIONS', 10 );

The WordPress documentation lists the values it accepts:

  • true, or -1: store every revision. This is the default.
  • false, or 0: store none, apart from one autosave per user.
  • A number above 0: store that many revisions per post, plus one autosave per user.

Ten is a fair starting point: it is enough history to undo a bad week of edits. A site where several people edit long pages may want more, and that is a call for each site.

Setting the limit is a one-off change we make with a backup taken first, and we tell you the number before we change anything.

Why did the limit not work after I added it?

Check where the line sits. The WordPress page on editing wp-config.php notes that some users could only get it to work after moving it to the first line under the file’s opening comment block.

The second reason is code. The wp_revisions_to_keep filter overrides WP_POST_REVISIONS, according to the developer reference, and since WordPress 5.8 there is also a filter for each post type, such as wp_page_revisions_to_keep. A plugin or theme that uses either one wins over your wp-config.php line.

There is a third case in the same source code. If a post type does not support revisions, the function returns 0 whatever you set.

What happens to the revisions you already have?

According to the documentation, old revisions are deleted automatically “when the post is updated again”. A limit does not reach back on its own. A page that nobody edits after the change keeps every revision it already had.

Clearing those means deleting rows from the database. Do it on a copy of the site first, with a fresh backup of the live one.

What did we not test?

Our lab confirmed the default and the count: five saves, five revisions, a limit of -1. We did not test the following on that site:

  • a numbered limit, and whether old revisions are removed on the next update as the documentation says
  • the false setting
  • deleting revisions in bulk with code or a plugin
  • how much space revisions take on a real site, since our test post was short

The lab ran on WordPress Playground, which builds a test site from a script, not on a live host.

What should you check today?

Open wp-config.php and search for WP_POST_REVISIONS. If it is not there, your site keeps every revision. Then open a page that changes often, look at the Revisions count in the editor sidebar, and decide how much history you want.

Revisions are the same kind of cost as the copies in our post on why one upload becomes 11 files in WordPress: storage that grows quietly and lands in every backup.

If you would like a second pair of eyes, tell us how your site is set up and we will check the revision setting and which pages carry the most history.

Where did these facts come from?

Questions and answers

Does setting a revision limit delete my old revisions straight away?

Not according to the WordPress documentation. It says old revisions are deleted when the post is updated again, so a post nobody edits keeps the pile it already has. We have not tested this part ourselves.

Should I set WP_POST_REVISIONS to false?

Only if nobody on the site ever needs to undo an edit. False stops revisions apart from the one autosave per user. A small number such as 10 keeps a way back without keeping years of drafts.

I added the line and nothing changed. Why?

Check where it sits in wp-config.php. The WordPress wp-config page notes that some users only got it to work after moving it to the first line under the opening comment block. A plugin or theme can also override it with the wp_revisions_to_keep filter.

Do autosaves pile up as well?

No. The WordPress documentation says there is at most one autosave per user for each post, and a new one overwrites the old one.

Rather hand this to us? See the WordPress maintenance plan