Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Speed & performance · Guide

How to Limit Post Revisions in WordPress

How to Limit Post Revisions in WordPress

Short answer

To limit post revisions in WordPress, add define( 'WP_POST_REVISIONS', 5 ); to wp-config.php above the stop-editing line, or use the free WP Revisions Control plugin for per-post-type limits. Then delete old revisions with WP-Optimize, after a full database backup.

Key takeaways

  • WordPress keeps an unlimited number of revisions per post by default, unless you set WP_POST_REVISIONS.
  • A limit of 3 to 10 revisions per post suits most blogs and business sites.
  • WP Revisions Control sets a different limit for each post type under Settings > Writing.
  • Setting a limit does not delete old revisions; WP-Optimize clears them after a backup.
  • Autosaves are separate from revisions, with at most one autosave per user per post.

What are WordPress post revisions?

A post revision is a saved copy of a post or page that WordPress keeps each time you save or update it.

Every save creates a new revision instead of overwriting the old text. The WordPress Revisions documentation says the revisions system stores a record of each saved draft or published update, and lets you see what changed in each revision by dragging a slider.

Revisions live in the database. The same documentation says revisions are stored in the posts table, as children of their associated post. They are not separate files, so they add rows to the same table that holds your posts.

You can view them from the editor. Open a post, open the Settings sidebar, select the Post tab, and click the number next to Revisions. Since WordPress 7.0, that opens a new revisions screen, while WordPress 6.9 and earlier use the classic screen, as the WordPress Revisions documentation explains.

Why should you limit post revisions?

You limit revisions because WordPress keeps an unlimited number per post by default, and those rows pile up in the database over time.

If you do not set a value, WordPress defaults WP_POST_REVISIONS to true, which means it keeps every revision. The Editing wp-config.php guide states this plainly: if you do not set this value, WordPress defaults WP_POST_REVISIONS to true.

A post you edited 40 times has 40 saved copies in the database. A site with hundreds of posts and years of edits can hold tens of thousands of revision rows. That bloat slows backups, makes database exports larger, and adds work to every query that scans the posts table.

Limiting revisions keeps the safety net while capping the cost. You still have recent versions to restore, but old copies stop piling up. Check your WordPress version first with our guide to checking your WordPress version, since the revisions screen looks different in WordPress 7.0 and later.

How many revisions should you keep?

Keep 3 to 10 revisions per post for most blogs and business sites, and more only if several people edit the same posts.

Three revisions cover a bad edit, a lost paragraph, and one more step back. Ten gives editors room to work on long posts over several days. The exact number is a trade-off between safety and database size, so pick the smallest number your team is comfortable with.

WordPress.com sets its own caps as a guide. The Jetpack revisions guide notes that WordPress.com saves 25 revisions for Free, Personal, and Premium plans, and 100 revisions for Business and eCommerce plans. A self-hosted site can match the lower end of that range and still have plenty of history.

Different post types can deserve different limits. A news post edited once needs fewer saved copies than a long guide that five people revise over a month. The plugin method in this guide lets you set a limit per post type, so you can keep 10 for posts and 3 for pages, for example.

How do you limit revisions with wp-config.php?

Add define( 'WP_POST_REVISIONS', 5 ); to wp-config.php above the “That's all, stop editing!” line.

This is the fastest method, and it needs no plugin.

Open wp-config.php in your WordPress root folder and add the line above the comment that reads /* That's all, stop editing! Happy publishing. */:

define( 'WP_POST_REVISIONS', 5 );

Change the 5 to any number you want. The Editing wp-config.php guide shows the same line with 3 as its example, and says you can use any integer, such as 3 or 12.

The limit applies from the moment you save the file. WordPress keeps only the newest revisions and drops older ones when the post is next updated. Old revisions already in the database are not removed by this line alone, so read the clean-up section below to clear them.

Back up the file before you edit it. A typo in wp-config.php can break the whole site, so keep a copy of the original and read our WordPress backup guide first if you have never edited the file.

How do you limit revisions with a plugin?

Install the free WP Revisions Control plugin, then set a limit for each post type under Settings > Writing.

This method suits you if you do not want to edit code, or if you want different limits per post type. The Kinsta revisions guide explains that WP Revisions Control lets you limit revisions or disable them per post type, and that setting the value to 0 disables revisions for that post type.

Follow these steps:

  1. Go to Plugins > Add New, search for “WP Revisions Control”, then install and activate it.
  2. Go to Settings > Writing and scroll to the WP Revisions Control section.
  3. Enter the number of revisions to keep for posts, pages, and any custom post types listed.
  4. Enter 0 for any post type where you want no revisions saved.
  5. Click Save Changes.

The plugin works through the wp_revisions_to_keep filter, which the WordPress Revisions documentation names as the way developers change how many revisions are kept for a post. Because the plugin sets limits per post type, it gives finer control than the single number in wp-config.php.

How do you delete old revisions you already have?

Use WP-Optimize to delete old revisions in bulk, after a full database backup.

Setting a limit stops new pile-ups, but it does not clear the old rows. The WordPress revisions documentation states there is an API function to delete revisions, but there is no built-in screen for it, so a plugin is the normal route.

Follow these steps:

  1. Back up the database first. Read our guide to backing up a WordPress database if you need the steps.
  2. Install and activate WP-Optimize from Plugins > Add New.
  3. Go to WP-Optimize > Database.
  4. Tick the box for “Clean all post revisions”.
  5. Untick any other clean-up you do not want, then click “Run all selected optimization”.

Those menu names come from the WordPress.org support answer on deleting revisions, which lists the same path and warns that a full site and database backup matters before you run it.

Check the result under WP-Optimize > Database after the run, and confirm a post you edited recently still shows its recent revisions in the editor. If the count looks wrong, restore the backup and try again with fewer options ticked.

How do you turn revisions off completely?

Set WP_POST_REVISIONS to false in wp-config.php, and WordPress will stop saving new revisions.

Add this line above the stop-editing comment in wp-config.php:

define( 'WP_POST_REVISIONS', false );

The Editing wp-config.php guide gives exactly this line for disabling revisions. From then on, saving a post keeps only the current version.

Think twice before you do this. Without revisions, a bad edit or an accidental delete cannot be undone from inside WordPress. Your only way back is a backup.

Turning revisions off suits a site where posts are written elsewhere and pasted in once, not a site where several people edit the same posts.

To turn revisions back on, open wp-config.php and remove the line, or change false to a number. The Jetpack revisions guide notes the same three choices: true or -1 keeps every revision, false or 0 keeps none, and a number keeps that many.

How do you change the autosave interval?

Add define( 'AUTOSAVE_INTERVAL', 180 ); to wp-config.php to change the autosave delay from 60 seconds to 180 seconds.

Autosaves are separate from revisions. WordPress auto-saves your work while you edit, and the Editing wp-config.php guide says the default delay is 60 seconds. The same guide shows 180 seconds as its example of a longer delay.

The WordPress Revisions documentation adds that there is only ever a maximum of one autosave per user for any given post, and new autosaves overwrite old ones. Autosaves also do not overwrite published content, so a half-written draft cannot replace a live post by accident.

A longer interval means fewer autosave rows, but it also means you can lose up to 3 minutes of typing if the browser crashes.

A shorter interval protects your work better at the cost of more autosaves. For most writers, the 60 second default is the right balance, and the revision limit matters more than this setting.

SettingDefaultWhat it controls
WP_POST_REVISIONStrue (unlimited)How many revisions WordPress keeps per post
AUTOSAVE_INTERVAL60 secondsHow often WordPress auto-saves while you edit
WP_POST_REVISIONS set to falseOffNo new revisions are saved
WP_POST_REVISIONS set to 55 per postOnly the 5 newest revisions are kept

How do you check the limit worked?

Edit a post several times, then open its revisions screen and count how many versions WordPress kept.

Run this check:

  1. Open a test post and save it 7 times with a small change each time.
  2. Open the Settings sidebar, select the Post tab, and click the number next to Revisions.
  3. Count the revisions listed. With a limit of 5, you should see at most 5 revisions plus 1 autosave.
  4. Use the slider at the top of the revisions screen to move between versions and confirm the oldest ones are gone.

The WordPress Revisions documentation explains that the revisions screen lets you move forward or backward through revisions, and that clicking Restore brings back the version you picked. Restoring a revision does not delete the newer ones, so you can undo a restore the same way.

If the count keeps growing past your limit, check that the wp-config.php line sits above the stop-editing comment and that no plugin is overriding it. The Editing wp-config.php guide notes that some users only got the setting to work after moving it to the first line under the opening comment block in wp-config.php.

What mistakes should you avoid?

Do not delete revisions without a backup, do not turn revisions off on a team site, and do not set the limit to 1.

These mistakes cause the most trouble:

  • Deleting all revisions before a big edit, then finding you need the old text back.
  • Setting WP_POST_REVISIONS to false on a site where several people edit posts, so nobody can undo a mistake.
  • Setting the limit to 1, which leaves almost no history when an edit goes wrong.
  • Editing wp-config.php in the wrong folder, so the limit never applies and the old rows keep growing.
  • Forgetting that the limit only trims revisions when a post is next updated, so old rows stay until you clean them up.

A limit of 3 to 10 revisions, plus a monthly database clean-up, keeps most sites tidy without losing useful history. If you want the wider clean-up routine, read our guide to optimizing the WordPress database.

Frequently asked questions

Does setting a revision limit delete my old revisions?

No, the limit only trims revisions when a post is next updated. Old revisions already in the database stay until you delete them. Use WP-Optimize and its Clean all post revisions option to clear them, after a full database backup.

Can I set a different revision limit for each post type?

Yes, but only if the same post type is covered. WP Revisions Control lets you set a number for each post type listed under Settings > Writing. If a custom post type is missing from the list, set the limit in wp-config.php instead, which applies to all post types.

How many post revisions should I keep?

Keep 3 to 10 revisions per post for most blogs and business sites. Three covers a bad edit and one step back, while ten gives editors room on long posts. WordPress.com keeps 25 revisions on its lower plans and 100 on Business and eCommerce plans, so 10 is a modest choice.

Does turning off revisions also turn off autosaves?

No. Autosaves are separate from revisions, and there is only ever one autosave per user for each post. Setting WP_POST_REVISIONS to false stops new revisions, but WordPress still auto-saves your work while you edit, using the AUTOSAVE_INTERVAL delay of 60 seconds by default.

Can I turn revisions back on after disabling them?

Yes. Open wp-config.php, remove the WP_POST_REVISIONS line or change false to a number such as 5, and save the file. New revisions will be saved from then on. Note that revisions deleted while the setting was off cannot be brought back, so only restore from a backup if you have one.

Sources

  1. Editing wp-config.php WordPress Developer Resources
  2. Revisions WordPress.org Documentation
  3. WordPress Revisions: How to Use and Optimize Them Kinsta
  4. WordPress Revisions: How to Enable, Disable, Limit & Delete Them Jetpack
  5. Deleting revisions to optimize database and speed WordPress.org Support

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.