One of the irritating feature for me in WordPress 2.6 is the post revision. I am the only author of my blog and hence this feature is useless to me.
Just in case you are wondering how post revision works, whenever a post is edited, a new row will be created in wp_posts table. Hence if your posts or pages got edited 10 times, you will have 10 new rows in wp_posts table.
In no time your wp_posts table will be filled up and the post ID will be huge.
To turn off this feature, add this following code to wp-config.php:
define('WP_POST_REVISIONS', false);
You can also delete all post revisions by running this query in phpMyAdmin:
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'
Be sure to backup your database first before performing any queries in phpMyAdmin.
*UPDATE* Auto Saves does not create a revision of the post.
*UPDATE 2* Updated SQL query from Andrei Neculau as the previous query does not delete from wp_postmeta and wp_term_relationships tables.
*UPDATE 3* There is a proper way of cleaning up Post Revisions as mentioned by kitchin in Deleting Post Revisions: do NOT use the a,b,c JOIN code you see everywhere. I like his method more than the SQL query above.
Thanks Lester!
I found this “feature” quite annoying as well and already posted about it on my own blog only to be notified by one of my friends that you provided solution.
Thanks a lot!
You are most welcome =)
Thank you! I have the same problem
before reading your post, I guess someone’ll create a plugin to cut this feature
Thank you, thank you, thank you so much. After 2 days of using 2.6 this was already irritating me beyond belief. I knew it would pay off when I subscribed to your RSS feed
Thank you. You’re a life saver…not the little mint candy kind.
Thank you so much for posting this to share. This new feature was already causing me problems with my Organize Series plugin and it looks like this will fix it!!
Thanks!!!! I was complaining about this issue earlier today and got pointed over here. I’m not completely fixed but I am content with the steps you provided above as it has taken away the biggest frustrations I have been experiencing.
Thanks you for the compliments =D
nice list.
It is crazy that WordPress doesn’t offer this as an option to turn off, I hate to do things directly to the code and database. What happens when you upgrade? At a minimum someone needs to create a plugin.
Awesome! That did the trick! Thank you.
Thanks a lot, this will save a lot of headaches later on. I have no idea why they bothered putting the revisions thing on as default…
Thanks for the post, I’m glad the feature can be turned off.
As for “why they bothered putting the revisions thing on as default”, this is the biggest problem with WordPress. A few people (or even just one) controls it, and decides what features will be included, and like it or not, we’re all stuck with it. A similar thing happened when they decided to scrap the database backup feature in favour of an XML export, despite the former being far superior. This is why some very good coders have abandoned WordPress.
This feature is a bit annoying when I’m trying to browse wp_posts table in phpMyAdmin..
I wonder if WP delete off old revision after n period of times?
@Jonathan Yea, WP is getting bloated
@Travis I don’t think it will delete after a certain period
Thank you!
Thanks for the fix.
Omg life saver. So relieved there is way to stop the revisions, and now i’m scared to go into phpMyadmin lol, because I don’t know what to look for or how to do this. I’ll poke around though, thank you for the solution though
I think this is not a feature but a bug and should be so reported. Both features (autosave and revisions) are fine, but the way it is done now is buggy. Autosave feature is at all softwares just ONE autosave of a page, and so it was working with WordPress. But after adding the revisions function, it started to make this copies. Revisions are fine, but revisions should be only of SAVED document, not autosave. It is also a SECURITY ISSUE – you can e.g. copy to the article the secret data and then you want to delete the secret parts, but with this autosave revisions bug, your secret data are stored in the database and everyone can reach them!
So
Yes autosave AND
Yes revisions
but no revisions for autosaves!
Autosave should create no revisions when saving drafts and one and only one revision when saving published posts. This works fine for me. If you are having problems, help us debug over on this ticket.