WordPress revisions are nothing new and depending on your writing style and management of your site they may be something very useful for you and the members of your site.
On the other hand they can be a horror story for many websites including some of the sites that NPSites.com develops.
For instance one of the sites we manage uses RSS Feeds from advertisers to build posts with descriptions and links from a large number of companies. For instance Walmart which is one of our advertisers announces their new deals from about 4am to 8am every morning. They offer about 30 feeds from specific departments in their store and special offers and markdowns.
Automating the Walmart feeds allows us to capture the feed data overnight then deploy it throughout the day.
Each feed will contain about 20 items. Some of the items are new and some are items from the current week or even older items that are getting re-announced.
When feeds of this type are read each item has a Unique Identifier number / code This allows NPSites to update prior posts and move them to the top of the list instead of making hundreds or thousands of duplicate posts for the same item.. for instance Taylor Swift’s albums have been on sale every day for the past year and there is no need to make hundreds of posts of the same deal .. but it may update price or something else in the offer…
|224955||Taylor Swift – Taylor Swift||2010-06-14 12:15:15||2010-06-14 12:15:15|
|224790||Taylor Swift – Taylor Swift||2010-06-14 07:45:14||2010-06-14 07:45:14|
|224585||Taylor Swift – Taylor Swift||2010-06-14 05:31:19||2010-06-14 05:31:19|
|224440||Taylor Swift – Taylor Swift||2010-06-14 03:15:21||2010-06-14 03:15:21|
|209894||Taylor Swift – Taylor Swift||2010-06-08 05:45:22||2010-06-08 05:45:22|
The list for just one item can get very long in just a few days.
When the feed is read and a older post needs updating a revision is made in the database. You can imagine that the feeds from Walmart alone can cause tens of thousands or hundreds of thousands of revisions. Actually in 30 days our one site can generate well over 100,000 revisions. It is pure insanity and there is no way to stop it without hacking at code.
Because its an unattended automated site we have resorted to a database cleaning then use of a plugin to remove the revisions. We will examine your options in this howto.
So, What Can You Do?
Now this may not be your problem but if you manage lots of editors / contributors you could endup with just as many or even more revisions in your Database…. And with the new options in WordPress 3.0 for easy management of many sites from one install this problem is going to be a serious concern for everyone.
The first thing you should do is limit your revisions by way of editing your wp-config.php file or installing a plugin that will limit your revisions.
You should also turn off autosaves if you do not make use of them or at the very least extend the time between autosaves.
Now we did this long ago but we still have revision problems and you probably will too.
To Remove your Revisions
If you are good with MySql you can use the following command.
DELETE FROM `databasename`.`wp_posts` WHERE post_type = "revision";
This command will search through all your posts and delete all of your revisions.
Use it carefully and backup your DB before you do.
Once you have deleted the bulk of your revisions you may need to go back and delete the new ones on a daily / weekly or monthly basis depending on the volume of data generated by your site.
Using Cron Jobs is an option and if you understand MySql you can setup a database call to be run at a time interval that is reasonable for your site.
Using a Plugin is probably a better option for many of us Delete-Revision is one NPSites has tried and it works well. It will also keep track of the number of revisions and give you a very nice “Happy Ending” Quote … and who doesn’t enjoy a Happy Ending…
Up to now Delete-Revision has deteted 54289 post revision of dedundancy,it’s easy . Wish happy ending !
AH YES … Happy Ending indeed.
This problem has been reported to the WordPress core developers by many people but it does not seem to be a high priority at this time. It may never be fixed so it will be up to us to look deeper inside of our databases to make sure it isn’t getting filled with garbage.
For shared Hosting Sites having your database inflate to enormous proportions can mean problems with your Hosting Company.
When we saw one of the sites we host had about 20,000 posts but a database size of over 300MB it was cause for serious concern.
Now every few days a site that had been set for 100% automation needs a visit.
If you have tens or hundreds of sites like this it becomes unreasonable to manage and you may be better off hacking into the core code yourself.