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.
Comments
11 Responses to “How to Disable Post Revisions in WordPress and Reduce Database Size”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.











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.
@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?
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.
Glad you made your way here from Six Revisions. Yes, it is possible. Simply use this plugin.
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!
Thanks.
Our database badly needed that !
Nice post but for my part I prefer to use this plugin http://wordpress.org/extend/plugins/wp-optimize/
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…
Wrong method of deleting post revisions
You got a better method? then please share.
Hey!
Good to see you responding
Here is the tutorial – http://blog.ashfame.com/2010/04/handling-wordpress-post-revisions-correctly/