• Categories
    • Tutorials
    • Beginners Guide
    • WordPress News
    • WordPress Security
    • Best WordPress Plugins
    • WordPress Themes
    • Product Reviews
    • WP Tips & Tricks
  • Guides
    • Start a Blog
    • Make a Website
    • WordPress Hosting
  • WordPress Hosting
    • A2 Hosting
    • HostGator
    • Bluehost
    • Cloudways
  • Managed Hosting
    • WPEngine
    • Rocket.net
    • WPX
    • Kinsta
  • Coupons
    • WPEngine
    • Flywheel
    • Cloudways
    • A2 Hosting
    • WPX Hosting
WordPress Tutorials

How to Disable and Remove Old Post Revisions in WordPress

Last Updated on: February 13, 2020 John Hughes 21 Comments

How to Disable and Remove Old Post Revisions in WordPress

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.

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, 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.

 

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.

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.

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. 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.

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, 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.

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.

This SQL query removes all posts from your database that have post_type = “revision”. You might want to create a backup of your database 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 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:

The WP-Optimize WordPress plugin.

Although this plugin offers a premium version 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.

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 and 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!

+ Share
Disclosure

John Hughes

Related Posts

Back to all articles
  • How to Increase the Memory Limit in WordPress

    How to Increase the Memory Limit in WordPress

  • What is WordPress? A Beginner's Guide!

    What is WordPress? What Can it do & Is it Right for You? A Beginner’s Guide

  • How to Use Git to Push Your Local Site Live

    How to Use Git to Push Your Local Site Live

Coupons

View more deals
  • Recipe Card Blocks Coupon
    15% OFF

    Recipe Card Blocks Coupon

    Running a cooking or food website can be fun (and tasty) – but
    Get This Deal
  • WP 2FA Coupon
    20% OFF

    WP 2FA Coupon

    Security should be at the forefront of all site owner’s min
    Get This Deal
  • Themskingdom Coupon
    20% OFF

    ThemesKingdom Coupon

    First impressions count. As such, you’ll want a WordPress t
    Get This Deal
21 Comments Leave a Reply
  1. Ash Buckles says

    December 6, 2010 at 4:33 am

    I think post revisions are worth having and the feature has saved me more than once. However, I think a plugin to bulk remove all revisions, manually, would be more beneficial than coding them out of WordPress altogether.

    Reply
    • Devesh says

      December 6, 2010 at 5:50 pm

      Hi Ash,

      If you want to use plugin to remove post revisions, check out this post –
      https://www.wpkube.com/plugin-for-wordpress-post-revisions/

      Thanks for commenting.

      Reply
      • Siva says

        December 14, 2010 at 2:54 am

        Great plugin…
        I am using GD Press Tool 🙂
        http://img214.imageshack.us/img214/1632/gdpresstool.png

        Reply
  2. Pete Carr says

    December 6, 2010 at 1:55 pm

    Hi Devesh,
    I would agree with Ash. They can be useful but also a pain in the behind. A plugin would be a good option, maybe that’s something you could look into.
    Pete

    Reply
    • Devesh says

      December 6, 2010 at 5:51 pm

      Hi Pete,

      Glad you found it useful. If you want to use plugin then check out this post
      https://www.wpkube.com/plugin-for-wordpress-post-revisions/

      Reply
  3. Dana says

    December 6, 2010 at 2:05 pm

    Are there any considerations why we need to remove it?

    Reply
    • Devesh says

      December 6, 2010 at 5:53 pm

      If you aren’t utilizing this feature then there is no need of keeping it.

      You can reduce your blog database size by removing and disabling the post revisions from wordpress.

      Reply
      • ryscript says

        March 29, 2012 at 1:21 am

        @Dana if you have multiple authors in your site I solely recommend to keep revisions enable, the reason is you’re able to back the old post at anytime, revisions seems to be the history of all your created and updated post and pages, you can also visit Disable and Remove All Post Revisions for more information.

        Hope it helps.

        Reply
  4. Ash Buckles says

    December 6, 2010 at 6:02 pm

    Very cool. Thanks for the plugin URL.

    Reply
    • Devesh says

      December 12, 2010 at 4:10 am

      You’re Welcome Ash. If you need any help about WordPress then don’t hesitate to contact us.

      Reply
  5. Amandeep Singh says

    December 10, 2010 at 4:03 pm

    This would help the bloggers get rid of another plugin.

    It is better to have a functionality with few lines of code rather than having a plugin.

    I am going to remove that plugin from my blog. Thanks for sharing this.. 🙂

    Reply
    • Devesh says

      December 12, 2010 at 8:33 am

      Yeah, doing manually is much better then using plugins.

      Thanks for the nice comment Amandeep.

      Reply
  6. Luke says

    August 11, 2018 at 7:16 am

    Im in Myphpadmin but what database do you run the query for. I keep getting error.

    DELETE from wp_posts WHERE post_type = “revision”;

    Reply
    • Dev says

      September 15, 2018 at 1:46 pm

      Hey Luke,

      If you have multiple sites on your server, you need to find out the database name (you can see the name in wp-config.php file).

      Hope that helps, if you need any help, let me know.

      Reply
  7. GaP says

    April 9, 2020 at 9:18 am

    Hi,
    I added
    define( ‘WP_POST_REVISIONS’, false );

    in my website’s root directory wp-config.php file but it didn’t work (revisions are still being saved) and errors are registered in the error_log:

    [09-Apr-2020 08:58:31 UTC] PHP Warning: Use of undefined constant ‘WP_POST_REVISIONS’ – assumed ‘‘WP_POST_REVISIONS’’ (this will throw an Error in a future version of PHP) in /home/wk32vkj3/mywebsite.com/wp-config.php on line 22

    Maybe something has changed since you wrote this post?

    Reply
    • Slobodan says

      April 9, 2020 at 9:44 am

      Try removing the single quotes around WP_POST_REVISIONS and add them manually, the encoding on the post content changed them to other versions of a single quote which don’t work inside of code.

      Reply
  8. J says

    August 29, 2021 at 4:55 pm

    Hello, I have been using this trick for ages, but it does not seem to work anymore. I just deleted 83 revisions from the database of my new site that im working on.

    I double checked, I have in wp-config.php
    define(‘WP_POST_REVISIONS’, false);

    Whats going on. I have the new block editor disabled, could that be related?

    Reply
  9. Angela Scott says

    October 3, 2021 at 7:57 pm

    Brilliant, thank you, just what I was looking for!

    Reply
  10. Esteban says

    January 23, 2022 at 1:29 pm

    We are in the process of removing 30,000 revisions which have basically disabled our bloated data base. So limiting the number that is created is a really good idea. We now just keep the one auto save revision.

    Reply
  11. Dimas says

    April 26, 2022 at 2:46 pm

    Keep in mind that a post revision also has associated meta data in the “wp_postmeta” table.

    Reply
  12. Carol Dunlop says

    April 26, 2022 at 4:35 pm

    Thank you so much for this article. WOW! It helped so much. I really didn’t want to install another plugin to get rid of the revisions which were just bloating the site. Glad you included the Cpanel piece.

    Reply

Leave a Reply Cancel reply

Full Disclosure This post may contain affiliate links, meaning that if you click on one of the links and purchase an item, we may receive a commission (at no additional cost to you). All opinions are our own and we do not accept payments for positive reviews.

THE BEST OF WPKUBE

Some of the best content we have published so far.

BEGINNER GUIDES & REVIEWS

18 Best Cheap WordPress Hosting Providers in 2023 (From $1.99)
210 Best WordPress Hosting Options for 2023 (Pros & Cons)
38 Best Managed WordPress Hosting Providers for 2023 Compared
45 Best WooCommerce Hosting Providers Compared in 2023 (All Budgets)
5Top 9 Landing Page Plugins for WordPress (2023)
69 Best List Building Plugins for WordPress In 2023
7How to Fix the 500 Internal Server Error on Your WordPress Website
8Thrive Themes Review: A Look At The Full Membership
9Beaver Builder Review: Is it The Best Page Builder Plugin for WordPress (2023)?
10OptimizePress Review: Create Landing Pages with Ease
11How to Make a Website: Complete Beginner’s Guide
12Top 22 Best Free Stock Photo Resources For Your Site
1317 of the Best Google Fonts for 2023 (And How to Use Them in WordPress)
14How to Start a Blog in 2022 (Step by Step Guide)
15How To Fix ‘503 Service Unavailable’ WordPress Error
1611 Best Contact Form Plugins for WordPress in 2023
17How to Add a Custom Logo to Your WordPress Site
18How to Fix Error Establishing a Database Connection in WordPress

WPEngine: 50% OFF Deal

Save 50% on one of the best managed hosting providers.

Get this Deal

Flywheel(our review)

Our Newsletter

Get awesome content delivered straight to your inbox.

Thank you!

You have successfully joined our subscriber list.

.
Featured In Forbes Huffpost Entrepreneur SEJ

About WPKube

WPKube is an online WordPress resource which focuses on WordPress tutorials, How-to’s, guides, plugins, news, and more. We aim to provide the most comprehensive beginner’s guides to anything about WordPress — from installing plugins, themes, automated installs and setups, to creating and setting up pages for your website.

We have over 500+ tutorials, guides, product reviews, tips, and tricks about WordPress. Founded by Devesh Sharma, the main goal of this site is to provide useful information on anything and everything WordPress.

Twitter Facebook

Useful Links

  • Behind the Scenes
  • Beginner Guides
  • WordPress Hosting
  • WooCommerce Themes
  • MeridianThemes
  • Exclusive WordPress Deals
View All Guides »

Reviews

  • WPEngine 33% OFF
  • Thrive Leads
  • Flywheel 33% OFF
  • Divi Theme 20% OFF
  • Thrive Architect
  • Elegant Themes
Reviews »

Deals

  • InMotion Hosting
  • LifterLMS Coupon
  • LiquidWeb Coupon
  • WPEngine Coupon
  • A2 Hosting
  • FloThemes
More Deals »
© Copyright 2023 WPKube ® All Rights Reserved.
  • Contact
  • Site Terms
  • Disclosure
  • Privacy Policy