Free Wordpress Blog Setup

How to Disable Post Revisions in WordPress and Reduce Database Size

By Editorial Staff in Tutorials
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.

What Next?

Digg it
Save This Page
Subscribe to WPBeginner
Stumble it
Free Wordpress Blog Setup

Comments

11 Responses to “How to Disable Post Revisions in WordPress and Reduce Database Size”
  1. Dan says:

    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.

    • Keith Davis says:

      @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?

  2. Keith Davis says:

    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.

  3. Sunangel says:

    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!

  4. Sidd says:

    Thanks.
    Our database badly needed that !

  5. Titifrim says:

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

    • Adhie says:

      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…

  6. Ashfame says:

    Wrong method of deleting post revisions

Share Your Opinions

Tell us what you're thinking...
and if you want a pic to show with your comment, then get gravatar!

Please make sure that you have read our Comment Policy.

Due to high volume of request from our readers, we are adding this feature that allows you to stay updated with this post's comments without having to participate in the discussion even though we would love your input as always. Don't worry we hate SPAM just as much as you do, so you will never receive any SPAM messages from our site and that's our promise to you.

Subscribe without commenting

Close Bar