Skip to main content

How to Disable or Limit Post Revisions

Did you know that WordPress saves a copy of your post every single time you hit the Save Draft button in the WordPress editor? Left unchecked, these save points, called WordPress Post revisions, can bloat your WordPress site’s database with unnecessary content.

In this post, we’ll first explain why you shouldn’t let your site store unlimited WordPress post revisions. Then, we’ll dig into some solutions to fix the problem, like how to limit, disable, or clean up WordPress post revisions.

Already know why it’s essential to limit WordPress post revisions? Click here to jump straight to the tutorial.

Why Limit or Disable WordPress Post Revisions?

First, a quick primer. Every time you save a draft in WordPress, WordPress stores that draft as a “revision”. This means that you can quickly go back and restore a previous version of your post if you mess something up, which is generally a good thing and the reason why it’s a feature built into the core WordPress software.

You can see how many revisions a piece of content has from the WordPress editor:

WordPress post revisions example

If you click that link, it will take you into the revision management interface, from which you can restore a previous revision if needed:

Compare WordPress post revisions

All good…except there’s a problem.

Each revision is a new entry in your WordPress site’s database. Over time, all those revisions can add up and insert unnecessary bloat to your database, especially for older posts where it’s unlikely you’d ever need to access the revisions.

Additionally, if you store unlimited revisions for each piece of content (which is the default behavior), you might have tens or hundreds of revisions for a single piece of content. Again, that adds up over time, and you’ll seldom need access to 10+ revisions.

The Solution(s)

There are a few solutions to this problem:

  1. You “limit” the maximum number of revisions that WordPress will store for each piece of content to something like “5”. This way, you can still benefit from revisions, but WordPress won’t store hundreds of revisions for a single piece of content.
  2. You completely disable revisions. I think this is overkill as revisions are a useful feature. I much prefer just limiting them. If you do opt to disable them altogether, you’ll need to be careful about working in the WordPress editor since you’ll no longer have a “save point” if you mess something up.
  3. You periodically clean out old revisions using a database cleaner plugin. You can do this manually, or many database cleaner plugins let you set up an automatic schedule.

Below, I’ll show you how to implement all three solutions.

How to Limit or Disable WordPress Post Revisions (Two Methods)

As with most things in WordPress, there are two main options to limit or disable WordPress post revisions:

  • With a plugin
  • Manually by editing your site’s wp-config.php file

I’ll show you both methods.

Plugin Method

If you don’t feel comfortable editing your site’s code, I recommend sticking with this plugin method as it’s the simplest way to limit post revisions in WordPress.

First, if you want to completely disable post revisions (rather than just limiting the number), then I recommend the free Disable Post Revision plugin from Joel James. It comes from an established developer and is super easy to use.

Once you install and activate the plugin, you just go to Settings → Writing to choose which post types to disable revisions on. That’s it!

How to disable WordPress post revisions

On the other hand, if you want to limit, but not wholly disable post revisions, then I recommend the free WP Revisions Control plugin, which lets you restrict revisions for individual post types.

Once you install and activate the plugin, go to Settings → Writing, and look for the WP Revisions Control section. There, you can set the limit of post revisions for each separate post type:

How to limit post revisions

When in doubt, I think storing 3-5 revisions is a good starting point.

wp-config.php Method

If you do feel comfortable working with your site’s wp-config.php file, you can also both disable and limit your post revisions by adding a single line of code to the file.

To get started, use FTP or cPanel File Manager to edit your WordPress site’s wp-config.php file.

Then, add one of the following lines of code somewhere above the ABSPATH line of code:

Completely disable WordPress post revisions:

define('WP_POST_REVISIONS', false);

Limit WordPress Post Revisions

define('WP_POST_REVISIONS', 4);

You can change the number (4) to any number. This number indicates the number of post revisions to store in your database. So if you set it equal to “4”, it will store the last four revisions before it starts overwriting older revisions.

How to Clean Out WordPress Post Revisions

In addition to (or instead of) limiting and disabling revisions, another strategy to optimize how your WordPress site handles post revisions is to clean out revisions using a database cleaner plugin periodically.

There are a bunch of plugins that can help you do this, including:

You can pick whichever one you prefer. But for revisions, I like Optimize Database after Deleting Revisions because it lets you choose between deleting all revisions or still storing a certain number of revisions. It also only does database cleaning, so it won’t interfere with any existing WordPress caching plugins that you might be using.

The plugin is easy to use. Once you install and activate it, head to Settings → Optimize Database to configure the plugin. Here, you can choose:

  • Which post types to delete revisions for.
  • Whether to only delete revisions that are older than X number of days, for example, delete all revisions that are more than 30 days old.
  • A maximum number of revisions to keep for each piece of content (it will keep the most recent revisions).

You can also delete some other database junk if desired:

Configure database cleaner

Then, to actually clean out your post revisions, go to Tools → Optimize Database.

Note – you should always back up your database before performing any operations on it.

Once you have a safe backup of your site’s database, you can click one of the Analyze buttons to perform a dry run. Basically, this lets you see the status of your site’s revisions, but it doesn’t delete anything yet:

Analyze database

Then, to delete those revisions according to your settings, click one of the Optimize buttons.

You’ll then see a summary of everything that the plugin did:

Clean revisions

Optimize Your WordPress Post Revisions Today

WordPress post revisions are a useful feature to help you save your work and revert back if needed.

However, left unlimited, WordPress post revisions can also clog your site’s database with tens or hundreds of unnecessary revisions for every piece of content on your site.

To fix this, you can:

  • Limit the number of revisions that your site stores, or disable them altogether.
  • Periodically clean out your site’s database to remove unnecessary revisions.

Do you still have any questions about working with WordPress post revisions? Leave a comment and let us know!

WordPress Design, WordPress Development, cPanel Hosting, Web Design, Web Development, Graphic Design, Mobile Development, Search Engine Optimization (SEO) and more.

Leave a Reply

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