---
description: https://www.wpkube.com/how-to-disable-post-revisions-in-wordpress/
---

# WORDPRESS TUTORIALSHow To Disable And Remove Old Post Revisions In WordPress (ok)



* [x] Manually deleting and disabling post revisions from your site’s code.
* [x] Installing plugins such as [WP Revisions Control](https://wordpress.org/plugins/wp-revisions-control/) and [WP-Optimize](https://wordpress.org/plugins/wp-optimize/).

[WORDPRESS TUTORIALS](https://www.wpkube.com/category/wordpress-tutorials/)

## How To Disable And Remove Old Post Revisions In WordPress

LAST UPDATED ON: FEBRUARY 13, 2020 [JOHN HUGHES](https://www.wpkube.com/author/thomasewer/) [16 COMMENTS](https://www.wpkube.com/how-to-disable-post-revisions-in-wordpress/#comments)![How to Disable and Remove Old Post Revisions in WordPress](https://www.wpkube.com/wp-content/uploads/2010/12/post-revisions1.png)

Occasionally updating or revising a post on your WordPress site isn’t a time-consuming task. It also doesn’t take up a lot of space. However, over time, revisions do start to add up and can eventually take up a considerable amount of space on your database.

Whether you’re in a pursuit to free up some much-needed space or prevent the matter altogether, disabling or removing old post revisions from your WordPress site is an available option. Doing either can help reduce database bloat and [optimize performance](https://www.wpkube.com/wordpress-maintenance-tasks/).

In this post, we’ll discuss what post revisions are and how they can be used. We’ll explain why you’d want to disable, limit, or remove them, and walk you how to do each one. Let’s get started!

### What Is a Post Revision?

[Post revisions](https://wordpress.org/support/article/revisions/), which are sometimes referred to as revisions, are a built-in feature of WordPress. They are useful because they make it easy to revert to a previous version of a post and undo the changes you made.

For example, let’s say you decided to delete some paragraphs in your post. However, later, you realize that edit was a mistake and want to recover the information you eliminated. With post revisions, you can easily do that.

In WordPress Gutenberg, this feature is located on the right navigation panel under _Document > Revisions_:

![The revisions tracker on a WordPress blog post.](https://www.wpkube.com/wp-content/uploads/2020/02/post-revisions.png)

If you’re still using the Classic Editor, you can find the revisions under the Publish box, also in the right navigation panel:

![The post revisions tracker in the classic editor of WordPress.](https://www.wpkube.com/wp-content/uploads/2020/02/classic-editor-revisions.png)

When you’re viewing revisions, WordPress shows you the new information that was added as well as what was removed through respective highlighting. New changes will be highlighted in green:

![A preview of the post revisions in WordPress.](https://www.wpkube.com/wp-content/uploads/2020/02/post-revision-changes.png)

There’s also a mode to compare versions of the revisions. When you select the version you want, you can click on the _Restore This Version_ button.

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

With the WordPress revisions system, each update or draft is recorded and gets stored in your WordPress database. While having the option to view the changes made to a post and restore previous versions can be super helpful, it can also take up space.

The more revisions you make, the more bloated your database can get. Database optimization is an important part of WordPress site maintenance. Therefore, managing the revisions on your site is highly recommended. Removing old revisions, for example, can reduce the size of your backups.

There are three main options to choose from for managing post revisions. You can disable them completely, limit how many are allowed, and remove the old post revisions. Below, we’ll cover how to go about each of these, starting with disabling post revisions.

### How to Disable Post Revisions in WordPress

One way to prevent an accumulation of revisions from piling up in your WordPress database is to remove the opportunity for them to in the first place. You can do this by disabling post revisions.

In order to disable post revisions permanently, locate your WordPress site’s _wp-config.php_ file that’s located in the root directory. Add the following line of code at the very top:

```
define( ‘WP_POST_REVISIONS’, false );
```

This line of code disables post revisions from being saved to your database in the future. If you’d like to enable this option sometime in the future (for whatever reason), simply replace the line with:

```
define( ‘WP_POST_REVISIONS’, true );
```

When you’re done, be sure to save your changes before exiting. Completely disabling post revisions isn’t necessarily something we recommend. There are other less drastic options you can pursue to optimize and manage revisions in your database. However, if you do want to do it, it helps to know that option is there and can easily be activated or deactivated when necessary.

### How to Limit Post Revisions in WordPress

If you’re like most people, you’ll want to save a couple of post revisions for every post you add to your site – just to be on the safe side. For this, the best option is to set a limit on the number of post revisions that are saved to your database.

You can do that by adding the following line to your wp-config.php file:

```
define( ‘WP_POST_REVISIONS’, 3 );
```

This line saves the three most recent post revisions instead of all of them, meaning the older ones are automatically deleted once newer versions are saved. You can replace the number three with another integer depending on your preference.

Instead of limiting the post revisions to a pre-defined number, you can also increase the auto-save interval to save fewer revisions. To do this, open up your site’s _wp-config.php_ file and add the following line at the top:

```
define( ‘AUTOSAVE_INTERVAL’, 600 );
```

By default, WordPress auto-saves your post revisions every minute (60 seconds). However, by adding this line it will save them every 10 minutes (600 seconds). This automatically reduces the number of post revisions that are stored in the database.

If you shy away from coding or adding code to your site’s _wp-config.php_ file, you can always get the job done by installing a plugin, such as [WP Revisions Control](https://wordpress.org/plugins/wp-revisions-control/). After you install and activate this plugin, you can configure that number of post revisions allowed by going to _Settings > Writing_:

![The WP Revisions Control WordPress plugin.](https://www.wpkube.com/wp-content/uploads/2020/02/wp-revisions-control.png)

It’s important that you understand that the techniques we covered so far disable or limit post revisions from being saved for future posts. What about the past revisions?

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

In this section, we’ll cover the two methods you can use to permanently remove old post revisions from your WordPress site’s database. If you’re familiar (and comfortable) with [SQL queries](https://www.wpkube.com/work-wordpress-database-11-useful-sql-queries/), you can go with the first method. However, if you’d prefer using a plugin then go ahead and skip right down to the second method.

### Method 1: Deleting Post Revisions Using Code

Deleting post revisions from your database is one of those things that you should be able to do without having to install a plugin (although there are plugins for it too, which we’ll cover next). After all, you’re trying to save space and installing a plugin generally goes against that.

In order to delete all of your past post revisions from your site’s database, login to the cPanel of WordPress site’s hosting account and click on the _phpMyAdmin_ icon.

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

![The SQL tab from the phpMyAdmin dashboard.](https://www.wpkube.com/wp-content/uploads/2020/02/phpmyadmin-sql.png)

You’ll be brought to the phpMyAdmin SQL interface. Next, where you can run an SQL query. You can do this by entering the following snippet of code:

```
DELETE FROM wp_posts WHERE post_type = "revision";
```

Make sure to replace wp\_ with your own WordPress database prefix. Then click on the _Go_ button. This will initiate the command:

![A snippet of code in the SQL query.](https://www.wpkube.com/wp-content/uploads/2020/02/run-sql-query.png)

This SQL query removes all posts from your database that have post\_type = “revision”. You might want to [create a backup of your database](https://www.wpkube.com/how-to-setup-free-automatic-backups-in-wordpress-with-updraftplus/) prior to running this query as an added security measure. In our opinion, it’s always best to make backups of your database before you make drastic changes to it.

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

Although deleting post revisions from your WordPress site can be accomplished by running a single SQL query, you might find it easier to [install a plugin](https://www.wpkube.com/complete-guide-choose-install-wordpress-plugins/) and let it do all the work. This might be because the plugin has added benefits (database maintenance, removes excess files etc.) or simply because you’re not comfortable with programming.

Whatever the reason, there are a variety of plugins you can use to delete old post revisions. One you might consider using is [WP-Optimize](https://wordpress.org/plugins/wp-optimize/):

![The WP-Optimize WordPress plugin.](https://www.wpkube.com/wp-content/uploads/2020/02/wp-optimize-plugin.png)

Although this plugin offers a [premium version](https://getwpo.com/buy/) with advanced features, you can download it and use it to delete old revisions for free. WP-Optimize is an all-in-one plugin that you can use to optimize your WordPress database. In addition to using it to delete revisions, you can also use it for important maintenance tasks such as image compressing and caching.

Once you install and activate the plugin, it will add a _WP-Optimize_ menu item to your WordPress dashboard. To delete post revisions, you can navigate to _WP-Optimize > Database_.

Under _Optimizations_, you can check the box next to ‘Clean all post revisions’, then click on the _Run Optimization_ button:

![The optimization settings page on the WP-Optimize WordPress plugin.](https://www.wpkube.com/wp-content/uploads/2020/02/database-optimizations.png)

You can delete the plugin or deactivate it once you’re finished with this process. That way, you don’t have to worry about it taking up any unnecessary space in your WordPress database.

### Wrapping It Up

Post revisions don’t slow your site down or threaten the User Experience (UX). They do, however, start to take up a lot of space on your site’s database over time. Fortunately, limiting or removing old post revisions will clear up a significant amount of space on your database.

As we discussed in this post, there are two methods you can use to disable, limit, or remove old post revisions from your WordPress site:

1. Manually deleting and disabling post revisions from your site’s code.
2. Installing plugins such as [WP Revisions Control](https://wordpress.org/plugins/wp-revisions-control/) and [WP-Optimize](https://wordpress.org/plugins/wp-optimize/).

Which method are you most comfortable with for disabling/removing old post revisions? Is there another method you use? Let us know in the comments section below!
