How To Turn Off Post Revision In WordPress 2.6

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.

1 Star2 Stars3 Stars4 Stars5 Stars (178 votes, average: 4.18 out of 5)

150 thoughts on “How To Turn Off Post Revision In WordPress 2.6”

  1. 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!

  2. Thank you! I have the same problem
    before reading your post, I guess someone’ll create a plugin to cut this feature

  3. 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 🙂

  4. 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.

  5. 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.

  6. 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…

  7. 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.

  8. 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? 😮

  9. 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 🙂

  10. 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!

  11. 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.

Comments are closed.