Have you ever had a Wordpress post that had so many changes in it that the version information at the bottom of the editor became so long and ugly, you are not alone. Here's a way to remove Wordpress revisions to keep your database small and fast.
Keeping document versions when changes are made are a nice feature. Imagine a multi editor environment like a steering committee that uses Wordpress as a means to archive their specifications. Typically a lead writer will drive the document creation process and create a draft. Other people are invited into the process to edit the content.
Whenever a change is made, snippets of the changes are stored, merged and the document is assigned a new version. Users can see who made the changes and generate a list. This is all wonderful and holds people accountable.
But let's get real here. Most Wordpress users don't need this feature. We aren't creating important documents that need this kind of feature. A case in point is, when you fire up your word processor, do you need to turn version control on? No.
Revision control under Wordpress, while nice to have, is pretty much a useless feature for many. Why I say this is because on your most frequently changed pages, the version list can grow very large and take over an entire page. For example, if you have a home page that gets edited frequently, you are not going to like this feature. Keeping a contact list of 1000 people? Add another contact and up goes the version number.
For every post touched, a database record is created. If you make lots of little changes, your database grows and grows and grows. Backing up the database takes longer and it takes up more disk space. In shared hosting environments, this creates more expense to the hosting provider. Especially so for those providers that host unlimited domains with tons of Wordpress websites on them. If you are on a hosting plan that limits your disk storage or charges you extra for more disk space, you are going to want to turn this feature off.
Frankly, I am very surprised that the folks at Wordpress didn't create a user interface feature in the administration console to turn this feature on and off. Or at least provide us with a feature that would remove all previous versions up to the current point.
With that said, I read some forum posts on the Wordpress site that suggested setting some configuration constants to turn off versioning.
And to clean up old versions out of the database you can perform this SQL query:
DELETE from wp_posts WHERE post_type = "revision";
However, after doing this, I still found version information being stored in the database.
So what do you do? You can hack away at the code or use a plug in.
I chose to continue to version my information and then use a plug in to delete Wordpress revisions periodically. The Better Delete Revision plugin lets you do this.
In addition, the plug-in will remove any data related to the version like metadata, tags, etc. So you get a clean all in one solution and not leave widowed information lying around.