Why You Should Disable Wordpress “Post Revisions” To Save Database Space

Wordpress has a function titled “Post Revisions” that when each time you save draft or publish a post or page and saves a revision copy of that post or page. It was introduced to help wordpress bloggers to keep revisions of post and restore to previous revisions anytime. This Feature can take up a huge chunk of database space however if you have a site that has a lot of articles, in this post we will show you several methods of how to disable the “Post Revisions” Feature and deleted stored revision posts from your database.

So whats the main benefit when disabling “Post Revisions” within wordpress?. Here at SocialCMSBuzz we had a database size of around 28MB, after disabling and deleting our “Post Revisions” this number dropped to around 8MB thats 20MB of a saving in MYSQL space within your wordpress database.

Method One – Getting Hands Dirty

The first method we will show you requires you to edit the wp-config.php to disable “Post Revisions” and also run an SQL query from within phpmyadmin to delete any stored “revision” posts from your wordpress database. There are several options we can use when disabling post revisions, read more about them here Revision Management.

To simply disable Wordpress posts revisions completely we have to edit the wp-config.php file found in you wordpress root directory.

Copy and Paste the code below into your wp-config file, this will disable post revisions.

define('WP_POST_REVISIONS', false);

Next we need to run an SQL query from within PhpMyAdmin to delete the “Post Revisions” from your database. Remember to backup your database first as you always should before running any queries.

Run this query below

DELETE FROM wp_posts WHERE post_type = "revision";

Another query you could try is an older one from Lester Chan which deletes “Post Revision” data from wp_postmeta and wp_term_relationships tables also.

DELETE a,b,c  
FROM wp_posts a  
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)  
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)  
WHERE a.post_type = 'revision'

Method Two – Use A Plugin

There are also a few plugins available to preform this task if you wish to use these we have listed them below for you.

Wordpress Revision Control Plugin


Revision Control is a plugin for WordPress 2.8+ which gives the user more control over the Post/Page Revisions.

The plugin allows the user to set a blog-global setting (Settings -> Revisions) for pages/posts to enable/disable/limit the number of revisions which are saved for the page/post. The user may change this setting on a per-page/post basis from the Revisions Meta box.

The plugin also allows the deletion of specific revisions via the Revisions post metabox.

Wordpress Delete Revision Plugin


Let us know if you use any of these methods, how you get on and if you saved any database size.

If you enjoyed this post, make sure you subscribe to our RSS feed!

Article Details


Author: Lincoln on November 25th, 2009

Category: Wordpress, Wordpress Hacks

Tags: ,

  1. Heather says:

    I installed the plugin on one of my sites but found that it only affects revisions going forward from the time you installed it – it does not remove existing revisions. So, I ran the SQL query as well. As a result, its database size went from 983 KB to 60kb in less than a minute. How. Cool. Is. That.

  2. Lincoln says:

    Hi Heather,

    Did you install both plugins? the first Wordpress Revision Control Plugin allows you to control the revision options and the second Wordpress Delete Revision Plugin should allow you to delete them.

    Let me know if you tried the Wordpress Delete Revision Plugin and if it was that plugin that didn’t work. If so i will edit the article to reflect this.

    Thanks and happy this help you save some space :)


  3. Kenneth says:

    Hi, is their a way to change of often the “Post Revisions” saves a revision? Like every fifth minute or so?

  1. Scrap Wordpress “Post Revisions”? | BloggerTools.Net

Leave a Reply