Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Disable Post Revisions in WordPress and Reduce Database Size

Last updated on by
Follow WPBeginner on YouTube
How to Disable Post Revisions in WordPress and Reduce Database Size

Post revisions is a great feature that WordPress has to offer but for some users it might not be the best option. For users who have limited database space, or for users creating WordPress as a CMS where they don’t need autosave, they can simply disable Post Revisions feature in WordPress by following this tutorial. By reducing the database size, you can also speed up your site.

Open wp-config.php located in your WordPress root directory and add the following code:

define('AUTOSAVE_INTERVAL', 300 ); // seconds
define('WP_POST_REVISIONS', false );

This code will disable all future revisions to be saved and it will also increase your autosave interval from 60 seconds to 300 seconds, so it means your post will be autosaving every 5 minute instead of every minute.

The above code, will not delete your past revisions that are already saved in your database. To delete all previous revisions, you will need to visit PHPMyAdmin and run the following SQL query.

DELETE FROM wp_posts WHERE post_type = "revision";

This should disable Post revisions and delete all previously saved post revisions stored in your Database.

Disclaimer: We are not suggesting that Post Revisions is a bad option. This tutorial is only for those who are in the situation where they need to reduce their database size.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • orangorangan

    Hi, seems like doesnt work for WordPress 3.8 ?

    • http://www.wpbeginner.com/ WPBeginner Support

      It works perfectly fine on WordPress 3.8

  • Sajna

    Will it work for Wordperss 3.7?

    • http://www.wpbeginner.com/ WPBeginner Support

      Yes.

  • http://www.namase.com/ namaserajesh

    Nice tips, instead of disabling revisions I’ll keep revision count 2 or 3. Thanks for this info. Great blog.

  • axelchanfrault

    This is a very clever tip, I never thought of that. Thanks!

  • http://bacsoftwareconsulting.com/blog/ Boutros

    About the SQL query you have in your post:

    DELETE FROM wp_posts WHERE post_type = “revision”;

    For me it only works with single quotes around the term revision and not double quotes. (I have MySQL server version 5.1.30). I thought I mention this for others.
    Thanks,
    Boutros

  • http://mindofwill.com will

    really needed this one of my post had over 200 and i couldn’t figure out why. you guys are the best thanks a lot again

  • http://blog.ashfame.com/ Ashfame

    Wrong method of deleting post revisions

  • http://titifrim.com/ Titifrim

    Nice post but for my part I prefer to use this plugin http://wordpress.org/extend/plugins/wp-optimize/

    • http://www.desainqu.com Adhie

      Agreed with Titifrim. With wp-optimize, there is option to “remove all post revision”. Another option: Clean marked Spam comments, Clean Unapproved comments, and Optimize database tables…

  • http://thedyc.org/blog Sidd

    Thanks.
    Our database badly needed that !

  • http://www.orthodontistaz.com Sunangel

    Deleted rows: 356 (Query took 0.0240 sec)

    Yes, it does clog up the database tremendously fast! I have just been building this site – mostly over the weekend.

    Thank you for this fix!

  • http://easypublicspeaking.co.uk Keith Davis

    Came to this site via Six Revisions, great site, great tutorials.
    Never thought that all those post revisions are saved in a database… the database must get bigger and bigger!
    Can post revisions be deleted via the Dashboard? Would be useful for people like me who are OK with html and CSS but shy away from PHP coding.

    • http://www.wpbeginner.com Editorial Staff

      Glad you made your way here from Six Revisions. Yes, it is possible. Simply use this plugin.

  • http://thatcomputerguy.net.au/blog Dan

    You can also use something like http://wordpress.org/extend/plugins/revision-control/ if you want a bit more control over just turning off revisions altogether.

    • http://easypublicspeaking.co.uk Keith Davis

      @Dan… do you use this plugin yourself?
      I need something like this because the instructions… “run the following SQL query” to delete revisions, scares me to death.

      Will the plugin delete existing revisions?