WordPress Post Revisions: How to Disable or Limit Them

by | Last Updated Mar 24, 2021 | WordPress | 0 comments

Would you believe that WordPress saves a copy of your post every time you hit the Save Draft button on the editor’s sidebar? This is no small thing since it means not just saving content but preserving it on the server.

WordPress post revisions can fill your WordPress site’s database with useless content if left unchecked.

The post will explain why you should not let your site store continuous revisions of posts dating up to when you published them. 

In the following sections, we will implement some solutions that will enable us to limit, disable, or clean up WordPress post revisions.

Why Is It Important to Limit or Disable WordPress Post Revisions?

I’ll start with a quick introduction.

WordPress saves each draft as a revision whenever you save it.

That way, if you mess up something in your post, you can very quickly go back and restore a previous version if necessary. The truth is, this is generally a good thing, which is why it is a feature built into the WordPress software.

In the WordPress editor, you can see how many revisions a piece of content has gotten by looking at this column.

WordPress Post Revisions in Editor UI

When you click this link, you will see an interface that will allow you to review and edit the revision. If needed, you can also restore a previous revision.

WordPress Post Revision Management Interface

This feature is excellent, but there’s still this one problem.

Your WordPress site’s database keeps track of your revisions on each page, so each revision is a new entry there. Those revisions are cumulative and can add a lot of unnecessary bloat to your database over time.

It is improbable that you would ever need access to old posts that contain revisions, especially if they are older.

Additionally, assume you are storing unlimited revisions for each blog post (the default behavior). If that is the case, you may end up with tens or hundreds of revisions for a single piece of content.

You can always refer to all the revisions until you need them, but chances are you’ll rarely need to look at more than five revisions at a time.

The Solutions Are Here

We can resolve this problem in a couple of ways.

  1. You can set the maximum number of revisions that WordPress will store for a single piece of content at something like 5. WordPress will still store revisions for you, but it won’t save hundreds of revisions for a single post.
  2. The revisions feature is entirely disabled. Revisions are a handy feature, so this seems like overkill. I’d instead limit them. Let’s say you turn them off altogether. Therefore, you must be cautious when working with WordPress’s editor because you can no longer restore things if something goes wrong.
  3. You use database cleaner plugins periodically to remove obsolete revisions. It is possible to do this manually, or many plugins have a scheduler for automatic cleaning.

The following sections will walk you through implementing all three solutions.

Two Methods to Disable or Limit WordPress Post Revisions

You have two main options for limiting or disabling WordPress post revisions:

  • Through the use of a plugin
  • Using the wp-config.php file in your site

I will show you both approaches.

By Using a WordPress Plugin

If editing your website’s code is not your cup of tea, I recommend using this plugin method. It is the most straightforward way to limit post revisions.

What if you want to disable post revisions entirely instead of just limiting the number? If that’s the case, I recommend Joel James’ free Disable Post Revision plugin. Joel is a well-established developer, and it’s easy to use.

WordPress Disable Post Revision Plugin

Install and activate the plugin. You will be able to disable revisions on certain post types in the Settings -> Writing section. You’re done!

WordPress Disable Post Revision Settings

However, suppose you prefer to limit the number of post revisions but not fully disable them. In that case, that is possible by using the free WP Revision Control plugin.

WP Revisions Control Plugin

With this plugin, you can restrict individual post types.

Once the plugin is installed and activated, go to the Settings -> Writing page. You will find the WP Revision Control section here.

WP Revisions Control Plugin Settings

There you can set the maximum number of revisions for each different post type.

Whenever in doubt, storing around 3 – 5 revisions is a good number to start.

By Using the wp-config.php

The wp-config file of your site is easy to work with if you consider it to be user-friendly. By adding a single line of code to the file, you can also disable and limit your post revisions.

You can edit your WordPress site’s wp-config.php file by using SFTP or DirectAdmin’s File Manager.

Then, add one of the following lines of code to the wp-config.php file.

To turn off WordPress post revisions.

define('WP_POST_REVISIONS', false);

To limit WordPress post revisions.

define('WP_POST_REVISIONS', 4);

You may change the 4 to any number. These numbers indicate how many revisions to keep in your database.

In this example, it will save the last four revisions before overwriting older revisions.

How to Clean up WordPress Post Revisions

Cleaning up revisions with a database cleaner plugin is another strategy to optimize your WordPress site’s handling of post revisions.

Here are a handful of plugins you could use to accomplish this task:

It is up to you to choose which one to utilize.

When it comes to revisions, I like Optimize Database after Deleting Revisions because it gives you the option to delete the entire revisions or keep a certain number of revisions.

There is no impact on your site’s existing caching plugins since the plugin only does database cleaning.

You can easily use the plugin. After installing and activating the plugin, you will need to configure it in the Settings -> Optimise Database.

Optimize Database After Deleting Revisions Settings

The following options are available:

  • Delete revisions for particular post types.
  • Delete only revisions older than X number of days, such as revisions more aged than 30 days.
  • A maximum number of revisions you can make for any one piece of content.

If you wish, you can also remove some other unwanted data from the database.

Then, go to Tools -> Optimize Database to clear out your post revisions.

Always make sure your database is backed up before conducting any operation.

Optimize Database After Deleting Revisions Analysis Details

After creating a safe backup of your site’s database, you can click the Analyze button to take a test run.

This lets you know how many revisions your site has but does not delete anything.

Those revisions can then be deleted according to your settings by clicking the Optimize button.

The plugin will then show a summary of everything it did.

Clean up WordPress Post Revisions Using LiteSpeed Cache Plugin

If you have installed the LiteSpeed Cache plugin, you can clean the revisions easily.

Click on the LiteSpeed Cache -> Database, and it will open the Database Optimization page.

Then click on the Post Revisions, and the plugin will clean the revisions from your database.

Take Advantage of Your WordPress Post Revisions Today

Post revisions are a helpful feature in WordPress, so you can save your work and revert when needed.

WordPress post revisions can lead to your website’s database being clogged with tens or hundreds of unnecessary revisions when left untouched.

You can fix this by:

  • Make revisions to your website fewer, or disable them altogether.
  • Remove unnecessary revisions from your site’s database by cleaning it out periodically.

Are there any questions you still have related to WordPress post revisions? Feel free to comment and let us know!

If you enjoyed this tutorial, then you’ll love Rovity and our fast-growing premium shared hosting on the cloud. Check our subscription plans.

We engineered our cloud infrastructure with Performance, Speed, Scalability, and Security in mind.

That’s why we built Rovity with AWS, CloudLinux OS, DirectAdmin, and LiteSpeed Web Server.

Come and experience the next generation of shared hosting on the cloud

By Jafar Muhammed

Jafar Muhammed has 10+ years of experience in WordPress, web hosting, domain names, DNS, CDN, server administration, etc. He is an open web advocate. He is the CEO of Rovity, the fastest growing premium shared hosting startup in India.

Check Out These Related Posts

Avoid These 8 Blogging Mistakes in 2021

Avoid These 8 Blogging Mistakes in 2021

Blogging plays a large part in the $400 billion content marketing industry. Blogs are an excellent way to make substantial extra income. They're also powerful tools for generating traffic to your website. Blogging isn't just a part-time gig and a digital marketing...

read more
How to Add HTTP Security Headers in WordPress

How to Add HTTP Security Headers in WordPress

Would you like to add HTTP security headers to your WordPress website? With HTTP security headers, your WordPress website will have an extra layer of protection. This will prevent malicious activity from affecting your website performance. The tutorial below will walk...

read more

0 Comments

0 Comments

Submit a Comment

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