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. This ‘feature’ has been a terrible nuisance to me as well. Thank you very, very much for this helpful post. It’s brought a much needed smile to my hour of trying to figure out what’s going on.

    Now on to clean out database tables. I’m a bit, actually quite, disappointed with the devs on this one and definitely agree such a feature should be accessible under Settings in admin.

  2. After disabling Post Revisions, I did manage to get one post ID ‘skipped’ so far after about five test posts. Hopefully it’s not autosave causing this. There is still something that may be wrong and hopefully isn’t hastily overlooked (Ryan).

  3. Thanks for fix!!! I cannot believe WP guys came up with this “feature” and did not announce how to fix it…

  4. It appears there is another version of this fix out there.

    Is it this:

    define(‘WP_POST_REVISIONS’, false);

    or this:

    define (‘WP_POST_REVISIONS’, 0);

  5. Thanks for this great post Lester! I installed your Revision Control plugin, and followed your directions for deleting all the revisions in my database. Awesome! I couldn’t believe how many entries were in the database for the revisions. No wonder my post #’s were getting so high. Sheesh. This is sloppy work from WordPress.

  6. Is this what I need to clean up the old revisions?

    DELETE 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’

  7. @oldengine Yours is more detailed, as mine only cleans up wp_post table and not the term_relationships table and wp_postmeta table.

    Did the code work for you?

Comments are closed.