How To Remove Old Post Revisions And How To Limit New Post Revisions

I had to find out how to remove old post revisions and how to limit new revisions. A few hours ago I finished writing up a post. For some reason I had a problem with it and I ended up with about 30 revisions. By default, WordPress saves all the revisions you make to your posts and pages in the database. Every time you save a post, it is considered a revision.

Looking at the 30 revisions made me realize that this is crazy and that all these new and old saved revisions were bloating my blog and slowing it down.

I did some research on how to remove old post revisions and on how to limit new revisions. What I learned, I applied to my blog and not surprisingly the steps I implemented drastically reduced the amount of bloat in my database and it helped to speed up my blog.

Today I want to share this information and show you how to remove old post revisions as well as show you the steps to take to limit new revisions that are stored in your blog’s database. Hopefully I’ll save you a couple of hours of work and a lot of blog bloat.

How To Remove Old Post Revisions Stored In Database

First I wanted to find out how to remove the old post revisions stored in the database. After some digging around I have found several solutions. One involved changing some information in the MySQL files and I was not that courageous. I did not want to touch these files because I know that if I did something wrong I could completely screw up my blog. Even if I had a backup, I just did not want to go through the trouble.

Fortunately, I found a couple of plugins to do this task for me. One of them “Better Delete Revisions” had very good write ups but unfortunately it has not been updated for about 3 years (although people are still downloading it even today), so you may want to have a look at it anyway.

The second plugin was “Optimize DataBase After Deleting Revisions” and I chose to use it. For those who are opposed to adding more plugins to your site, it’s OK. All you do is to upload it and use it (the whole cleanup process takes less than a minute) just once, then delete it from your blog and once or twice  per month re-upload it  and do your clean up. That is exactly what I did.

You can download these free plugins from the links or you can get them directly from your plugin dashboard. Just enter the full name in the search box in your plugin dashboard.

After I used the “Optimize DataBase After Deleting Revisions”  plugin,  it got rid of almost 10 MB of junk from my database. You can just imagine how this cleanup really helped to speed up my blog. That’s a lot of stuff, gone! Honestly, I was quite surprised.

remove post revisions from database

How to reduce or limit post revisions

I also found some answers for limiting the number of post revisions for a new post. Right now WordPress will register and save every revision you make irrespective of the numbers. Not only that, it also saves the drafts by autosaves at certain intervals. I just don’t see the reason behind having so many safe checks. It just bloats our blogs and makes them sluggish.

There are several ways you can “order” WordPress to reduce the number of revisions it keeps. The “Optimize DataBase After Deleting Revisions” plugin that I mentioned before will do it.

But if you do not want to keep the plugin you can easily do it yourself. Below I’ll show you the steps I took. I am not techie so if I could do it, you can definitely do it too.

What you need to do is add a short code to your wp.config.php file in your file manager.

The code to add is:

define(‘WP_POST_REVISIONS’, 2);

You can replace the number in the code for any number you are comfortable with. WordPress will keep only the last 2 (or whatever number you choose) revisions.

Some people may want to completely eliminate post revisions (although I would not recommend this). In that case replace the number with 0 and no revisions will be kept.

define(‘WP_POST_REVISIONS’, 0);


Step By Step Instruction To Add Code Into Your wp.config.php File

1. In File Manager (in your cpanel) locate the wp.config.php file.

File manager wp config php file

wp.config.php file


 2. Highlight the wp.config.php file and click on edit (see image above). Open the editor and locate @package WordPress.

Insert cone into wpconfigphp file

Locate @package WordPress

3. In the editor add the code underneath */

Code to reduce number of post revisions

Insert The Code Below */

4. In your file manager, save the edit and you are done.


In summary, using the “Optimize DataBase After Deleting Revisions” plugin temporarily to remove old post revisions cleaned up my blog significantly. It removed almost 60% of unnecessary data from my blog’s database. That is huge! This action alone significantly contributed to speeding up my blog. As well, as I am writing this post WordPress is keeping my current post revisions on 2.

Although piddling with your wp.config.php files may seem frightening, believe me if I can do it you can too. Just follow the instructions above. Also, just in case, copy the file to notepad and save it should anything go wrong (nothing will go wrong).

Previously I wrote a couple of articles on blog speed. You may want to read both of them if you have not read them yet:

  1. Improve The Speed Of Your Website – Leverage Browser Catching, Enable Gzip Compression ~ read here…
  2. How To Optimize Images To Speed Up Your Blog ~ read on…

Please leave a comment and let me know if you found this post helpful. And, please don’t forget to like and G+ this article, if you enjoyed it. Thanks.

Don't Miss A Thing!  Sign Up For Weekly Newsletter & Updates
online success optin

Enter your name & email and  get a FREE copy of my ebook, Your Online Success Starts Here


millionaire's brain ad


, , , , ,

19 Responses to How To Remove Old Post Revisions And How To Limit New Post Revisions

  1. Ken Bishop May 3, 2014 at 4:59 pm #

    Hi Dita,
    Was going through the challenge facebook group and noticed your post on cleaning up the revisions on the wordpess posts. Came to your blog. Used the plugin first and it worked great plus I place the snippet of code in the config file. All went well and I wanted to thank you for making the post.
    Ken Bishop recently posted…Creating a Self In Picture Video While Doing a Screen Capture in CamtasiaMy Profile

  2. Boon May 3, 2014 at 1:39 pm #

    HI Dita,
    Thanks for the suggestion on the Optimize DataBase After Deleting Revisions plug-in. I have installed it on my Blog too.

  3. Mary May 2, 2014 at 5:26 pm #

    Hi Dita,
    Nice blog, I really found the suggestions about the Plug-in useful. I will definitely try it out, thank you!

  4. Catherine Rowan May 2, 2014 at 4:41 pm #

    Hi Dita,

    Thank you for the information above. I downloaded the plugin and it works really well.
    I won’t play around in my database either, I would be sure to delete some vital code and kill my blog stone dead.
    Catherine Rowan recently posted…(In) Secure!My Profile

    • Dita Irvine May 2, 2014 at 6:40 pm #

      Hi Catherine,

      I know exactly how you feel! I felt the same when I first did it. The best is to copy the whole config.php file to a notepad to replace it should anything get crewed up. But it won’t because it is a very minor change. Anyway, I will shoot a video and I will post it here on the blog and also in the QSC.
      Dita Irvine recently posted…How To Disable Annoying WordPress Toolbar When Previewing PostsMy Profile

  5. David Merrill 101 January 1, 2014 at 2:48 pm #

    This is very helpful information, Dita.

    I’m always trying to keep my blog from getting too “heavy”, and this will really help.

    Personally, I prefer using the plugin because I don’t like to mess with code. Call me chicken, but I’m always afraid to break something.
    David Merrill 101 recently posted…Content CurationMy Profile

    • Dita Irvine January 8, 2014 at 2:39 pm #

      Hi David,

      I often feel like you too. I will do small modifications like making changes in the .htaccess. Only once did I venture into my database and even then I had the wonderful Hostgator staff right by me. Despite their help I still felt so nervous that I vowed never to fool around with databases.

      Dita Irvine recently posted…How To Update Your WordPress Blog Theme Without Any HasslesMy Profile

  6. Adrienne December 16, 2013 at 12:24 pm #

    Hi Dita,

    I use WP Optimize so just to make sure, I installed this one and ran it. Sure enough, WP Optimize also removes all of the revisions.

    I thought it did but this was a great way to make sure.

    Unless you’ve had issues with your database tables then people don’t realize that these things don’t get cleaned out by themselves. Thanks for sharing this plugin and it sounds like a good one too.

    Enjoy your week.


    • Dita Irvine January 8, 2014 at 3:01 pm #

      Hey Adrienne,

      I was just going through my spam box and I found your reply there. Thank goodness my spam folder does not automatically empties.

      I am glad you enjoyed this post and found it helpful. It makes me feel I am paying you back for all the wonderful posts I am reading on your blog.

      Take care

  7. Ferdi December 15, 2013 at 5:03 am #

    That is the thing with databases you can not realy see what kind of junk is in it, and with a web 2.0 blog with nice images etc… loading times can become an issue fast. I deleted 378 revisions from my wordpress blog which is only 1 year old now. Thanks for sharing these plugins…

  8. Sandy Halliday December 14, 2013 at 3:55 am #

    Hey Dita,

    This is very interesting. It’s not something I have considered before when it comes to blog loading times and not something I have read about before either.

    I have always wondered about all those revisions that WordPress saves but never thought about trying to find out how to prevent them.

    I will certainly follow your instructions now. Great post.

    Sandy Halliday recently posted…No Fuss Paleo Detox: Clean Your System and Drop the WeightMy Profile

  9. sherman smith December 13, 2013 at 8:33 pm #

    Hey Dita,

    Thanks for this information about cleaning up your database. I’m always looking for something that will help speed up my blog. I haven’t cleaned my database up in a while, and I’ve used a plugin in the past, but I just recently got rid of some. I’ll install this one since it’s one that I definitely need to do that “spring cleaning” in the winter! Thanks for the suggestion!
    sherman smith recently posted…What Are 11 Alternatives You Can Use Besides Google Adsense?My Profile

  10. Mark Salmon December 13, 2013 at 5:35 am #

    Hi Dita,

    Thank you for this post – by using the plugin you recommend, I deleted 3,930 revisions from one of my old blogs and 709 revisions from my new blog – in the latter case dropping the database size by 63%!

    Nice work Dita.

    kind regards

    Mark Salmon

    • Dita Irvine December 13, 2013 at 2:52 pm #

      Hi Mark,

      Nice to see you here. Isn’t it awesome. The same happened to me. I was amazed at the amount of junk I had in my database. I am glad I was able to help.

      Take care

  11. Cararta December 12, 2013 at 11:26 pm #

    Hi Dita,

    You are a Saint! Was working on my blog today, went looking for my
    plugin that I use to remove extra revisions, couldn’t find it,

    Decided to take a trip to Bloggers Roadmap and there you are…answering
    my question before I asked it.

    Thanks for the very handy share.
    This is gong to be short and sweet, cause I have some more work to do!

    Cararta recently posted…Did Affiliate Marketing Change on November 14th. ????My Profile

    • Dita Irvine December 13, 2013 at 2:54 pm #

      Hi Cararta,

      I chuckled when you called me Saint??? You are too funny. This is such time saver and blog speeder. Take care and happy holidays if I don’t “see” you before that.