One of the hot new features of 2.6 is post/page revision management. This is a splendid feature for multi-author blogs because it allows you to see what was changed in a post, by whom and when. Unfortunately, this is a bit overboard for single author bloggers who truly don’t need to keep a running tally of every single revision.
Since WordPress developers didn’t disable this feature by default or provide a distinct option under Settings, it will require a bit of file editing or installation of a plugin to properly manage.
Disabling or Limiting Post Revision Control
There is a section in the Codex which deals with the revision management, but for someone who is not well versed in structuring PHP statements or setting constant variables, it falls into the not particularly helpful category. That’s where this tutorial comes in.
Before we get started, you’ll be making edits to your wp-config.php file, so it’s important for you to make a back up copy and save it in a safe place. Also, make sure that you edit the file only using a plain text editor (such as Notepad) or an editor developed specifically for HTML/PHP editing (such as Dreamweaver in code view). With that out of the way, let’s get started.
Completely Disable Post Revisions
If you’d rather not have to deal with any revisions at all, then you can completely disable the feature by adding the following code in your wp-config.php file–just make sure it falls between the opening ‘
<?php‘ and closing ‘
Limit the Number of Saved Revisions
Now, if you’d rather have some level of revision management, but would like to limit the number of revisions saved. Rather than using ‘false’, simply add the number of revisions you’d like to have saved–old revisions beyond the number specified will simply be deleted. Again, this code is to be placed somewhere between the opening
<?php and closing
Now, to be certain, this will not fix the post ID issue if you’re averse to having it climb each time a new revision is saved. This is more along the lines of saving storage space.
*As a general rule of thumb, I add any preference changes just before the closing ‘
?>‘ with a comment about what the function does.
>>WP config file stuff
/* DISABLE POST REVISIONS */
Disabling Post Revisions with a Plugin
In general, I don’t recommend plugins unless it’s completely necessary. But, if you don’t feel like mucking around with PHP or your files, then you can also turn off your post revisions with a handy little plugin.
Actually, it’s three little plugins. You have the option of downloading the disable auto-save (not entirely recommended), disable post revisions, or disable both (again, not entirely recommended) plugins.
Understanding Revision Control and Auto-save
Revision control basically tracks the changes made to a post and saves previous versions for you to revert back to if necessary. Auto-save just saves the post periodically so you don’t loose the content should a catastrophe happen, like your browser freezing or your computer randomly shutting down, prior to manually saving.
While each revision is stored in its own database table, the auto-save is only stored once with previous versions being overwritten by the new auto-saved content. So, if you’re worried about your database growing to massive proportions because of auto-save, you can stop worrying. And trust me, auto-save is not a feature you want to disable; it only takes one arduously crafted blog post lost into the ether for you figure that out.
One option, rather than completely disabling the feature, is to reset the frequency. By default, WordPress will auto-save a post every minute (60 seconds). To delay this, simply add the following code to your wp-config.php file:
The number, 600 in the example, represents the number of seconds WordPress should wait between auto-saves. So, the above example would set WordPress to auto-save the post every 10 minutes.
Deleting Excess Post Revisions
Chances are you’ve already upgraded to the latest version of WordPress and made a whole lot of edits to some of your previous blog entries which resulted in a database filled with revisions. Basically, your DB has fluffy data that isn’t quite necessary and you’re wondering how to get rid of it.
Well, with a quick and dirty DB query of course. Please note, this should not be attempted if you do not feel comfortable running DB queries in any way and you should always make a back up and test the query first before actually deleting anything.
(This tutorial assumes you’ll be using phpMyAdmin as your MySQL manager.)
Step 1: Log into your phpMyAdmin panel
Step 2: Click on the SQL tab which should bring you to a page with the SQL query box
Step 3: Type the following query (courtesy of Andrei Neculau), making the appropriate changes for your WP installation’s table prefix, and hit the Go button:
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';
Bear in mind that this will delete all revisions from every post including all of its meta data.