How to Disable and Remove Old Post Revisions in WordPress
/ / How to Disable and Remove Old Post Revisions in WordPress

How to Disable and Remove Old Post Revisions in WordPress

Some of the links in this post are affiliate links. This means if you click on the link and purchase the item, We will receive an affiliate commission at no extra cost to you. All opinions remain our own.

Occasionally updating or revising a publish on your WordPress site isn’t a time-consuming job. It additionally doesn’t take up a lot of areas. However, over time, revisions do start to add up and might ultimately take up an appreciable quantity of area on your database.

Whether you’re in a pursuit to free up some much-needed area or forestall the matter altogether, disabling or eradicating outdated publish revisions out of your WordPress site is an out-there choice. Doing both will help scale back database bloat and optimize performance.

In this publish, we’ll talk about what publish revisions are and the way they can be utilized. We’ll clarify why you’d wish to disable, restrict, or take away them, and stroll you find out how to do each. Let’s get began!

What Is a Post Revision?

Post revisions, which are generally known as revisions, are a built-in feature of WordPress. They are helpful as a result of they make it straightforward to revert to an earlier model of a publish and undo the adjustments you made.

For instance, let’s say you determined to delete some paragraphs in your publish. However, later, you notice that the edit was a mistake and wish to recuperate the knowledge you eradicated. With publish revisions, you may simply do this.

In WordPress Gutenberg, this feature is positioned on the fitting navigation panel underneath Document > Revisions:

If you’re nonetheless utilizing the Classic Editor, you will discover the revisions underneath the Publish field, additionally in the fitting navigation panel:


When you’re viewing revisions, WordPress exhibits you the brand new info that was added in addition to what was eliminated using respective highlighting. New adjustments will be highlighted in inexperienced:


There’s additionally a mode to match variations of the revisions. When you choose the model you need, you may click on the Restore This Version button.

Why Would You Want to Disable, Limit, or Remove WordPress Post Revisions?

With the WordPress revisions system, every replacement or draft is recorded and will get saved in your WordPress database. While having the choice to view the adjustments made to publishing and restore earlier variations might be tremendously useful, it will possibly additionally take up area.

The extra revisions you make, the extra bloated your database can get. Database optimization is a vital half of WordPress site maintenance. Therefore, managing the revisions on your site is extremely beneficial. Removing outdated revisions, for instance, can scale back the scale of your backups.

There are three important choices to select from for managing publish revisions. You can disable them utterly, restrict what number of are allowed, and take away the outdated publish revisions. Below, we’ll cowl find out how to go about every of these, beginning with disabling publish revisions.

How to Disable Post Revisions in WordPress

One option to forestall an accumulation of revisions from piling up in your WordPress database is to take away the chance for them to be in the primary place. You can do that by disabling published revisions.

To disable publish revisions completely, find your WordPress site’s wp-config.php file that’s positioned in the foundation listing. Add the next line of code on the very high:

outline( ‘WP_POST_REVISIONS’, false );

This line of code disables publish revisions from being saved to your database in the longer term. If you’d wish to allow this selection someday in the longer term (for no matter reason), merely substitute the road with:

outline( ‘WP_POST_REVISIONS’, true );

When you’re performed, you'll want to save your adjustments earlier than exiting. Completely disabling publish revisions isn’t essentially one thing we suggest. There are different much less drastic choices you may pursue to optimize and manage revisions in your database. However, for those who do wish to do it, it helps to know that choice is there and might simply be activated or deactivated when essential.

How to Limit Post Revisions in WordPress

If you’re like most individuals, you’ll wish to save a couple of publishing revisions for each publish you add to your site – simply to be on the protected facet. For this, the best choice is to set a restriction on the number of publishing revisions that are saved to your database.

You can do this by including the next line to your wp-config.php file:

outline( ‘WP_POST_REVISIONS’, 3 );

This line saves the three most up-to-date publish revisions as an alternative to all of them, which means the older ones are robotically deleted as soon as newer variations are saved. You can substitute the quantity three with one other integer relying on your choice.

Instead of limiting the publish revisions to a pre-defined quantity, it's also possible to improve the auto-save interval to avoid wasting fewer revisions. To do that, open up your site’s wp-config.php file and add the next line on the high:

outline( ‘AUTOSAVE_INTERVAL’, 600 );

By default, WordPress auto-saves your publish revisions each minute (60 seconds). However, by including this line it will save them each 10 minutes (600 seconds). This robotically reduces the number of publishing revisions that are saved in the database.

If you shrink back from coding or including code to your site’s wp-config.php file, you may all the time get the job performed by putting in a plugin, similar to WP Revisions Control. After you put in and activate this plugin, you may configure that quantity of publishing revisions allowed by going to Settings > Writing:

The WP Revisions Control WordPress plugin.

It’s vital that you simply perceive that the methods we lined thus far disable or restrict publish revisions from being saved for future posts. What in regards to the previous revisions?

How To Remove Old Post Revisions In WordPress (2 Methods)

In this part, we’ll cowl the 2 strategies you should utilize to completely take away outdated publish revisions out of your WordPress site’s database. If you’re acquainted (and comfy) with SQL queries, you may go along with the primary technique. However, for those who’d want to utilize a plugin then go forward and skip properly all the way down to the second technique.

Method 1: Deleting Post Revisions Using Code

Deleting publish revisions out of your database is one of these issues that you need to be capable to do without having to put in a plugin (though there are plugins for it too, which we’ll cowl subsequent). After all, you’re attempting to avoid wasting area, and putting in a plugin typically goes towards that.

To delete all of your previous published revisions out of your site’s database, log in to the cPanel of WordPress site’s hosting account and click on on the phpMyAdmin icon.

In the left navigation panel, discover and click on on your WordPress database. Click on the SQL tab:

The SQL tab from the phpMyAdmin dashboard.

You’ll be dropped at the phpMyAdmin SQL interface. Next, the place you may run an SQL question. You can do that by coming into the next snippet of code:

DELETE FROM wp_posts WHERE post_type = "revision";

Make certain to interchange wp_ with your individual WordPress database prefix. Then click on the Go button. This will provoke the command:

A snippet of code in the SQL query.

This SQL question removes all posts out of your database which has post_type = “revision”. You may wish to create a backup of your database previous to operating this question as an added safety measure. In our opinion, it’s all the time best to make backups of your database earlier than you make drastic adjustments to it.

Method 2: Use a WordPress Plugin to Delete Old Post Revisions

Although deleting publish revisions out of your WordPress site might be achieved by operating a single SQL question, you may discover it simpler to put in a plugin and let it do all of the work. This could be as a result of the plugin has added advantages (database maintenance, removes extra recordsdata and many others.) or just since you’re not comfy with programming.

Whatever the reason, there is a selection of plugins you should utilize to delete outdated publish revisions. One you may think about using is WP-Optimize:

The WP-Optimize WordPress plugin.

Although this plugin provides a premium version with superior features, you may obtain it and use it to delete outdated revisions for free. WP-Optimize is an all-in-one plugin that you should utilize to optimize your WordPress database. In addition to utilizing it to delete revisions, it's also possible to use it for vital maintenance duties similar to image compressing and caching.

Once you put in and activate the plugin, it will add WP-Optimize menu merchandise to your WordPress dashboard. To delete publish revisions, you may navigate to WP-Optimize > Database.

Under Optimizations, you may examine the field after ‘Clean all post revisions’, then click on on the Run Optimization button:


You can delete the plugin or deactivate it when you’re completed with this process. In that manner, you don’t have to fret about it taking on any pointless area in your WordPress database.

Wrapping It Up

Post revisions don’t gradually your site down or threaten the User Experience (UX). They do, nonetheless, start to take up a lot of area on your site’s database over time. Fortunately, limiting or eradicating outdated publish revisions will clear up an important quantity of area on your database.

As we mentioned in this publish, there are two strategies you should utilize to disable, restrict, or take away outdated publish revisions out of your WordPress site:

  1. Manually deleting and disabling publish revisions out of your site’s code.
  2. Installing plugins similar to WP Revisions Control and WP-Optimize.

Which technique are you most comfy with for disabling/eradicating outdated publish revisions? Is there one other technique you employ? Let us know in the comments part under!