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:

1
define('WP_POST_REVISIONS', false);

You can also delete all post revisions by running this query in phpMyAdmin:

1
2
3
4
5
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.

Tags: , ,

Email This Post Email This Post Print This Post Print This Post

1 Star2 Stars3 Stars4 Stars5 Stars (131 votes, average: 4.01 out of 5)
Loading ... Loading ...

 

139 Responses to “How To Turn Off Post Revision In WordPress 2.6”

  1. Thank you. You’re a life saver… Thanks again for proving sql query to delete the old revision posts. :)

    Free Wordpress themes did not rate this post.
  2. [...] clean up was a hack of a sort since it is not (yet) an option within the WP Admin panel that lets one turn off the auto save [...]

  3. aflie Says:

    hi, lester
    the code within your post seems beautiful, how can I do that? use a code highlight plugins or manually edit css file?

    aflie did not rate this post.
  4. Lester Chan Says:

    I am using WP-Syntax, http://wordpress.org/extend/plugins/wp-syntax/

    Lester Chan ratings for this post: Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5
  5. aflie Says:

    thanks, It is a nice plugin!

    aflie did not rate this post.
  6. Thanks a ton for your help.
    I went mad afer upgrading to WP 2.6.
    I added define (’WP_POST_REVISIONS’, 0); in my WP-CONFIG file but I am still seeing the autosave functionality.
    Is there any other trick ?

    Freshers Jobs did not rate this post.
  7. Lester Chan Says:

    it will still autosave, but it will not create the revisions

    Lester Chan ratings for this post: Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5
  8. Stijn Says:

    Thanks a lot, Lester! Disabling and then deleting all those revisions cut my db size in half!

    Stijn did not rate this post.
  9. Terje Says:

    Will it be the same if you just change the WP_POST_REVISIONS in wp-settings.php from true to false?

    Terje did not rate this post.
  10. Lester Chan Says:

    It is not recommended to touch the core files as you will lose them if you upgrade

    Lester Chan ratings for this post: Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5
  11. ardiweb Says:

    I really need this post. I don’t know about this feature, usefull or useless..
    Many thanks….

    ardiweb did not rate this post.
  12. [...] Bagi saya fitur ini tidak berguna, karena hanya akan membuat database penuh dengan data-data tidak berguna. Dan saya menjadi terganggu karenanya. Kemudian saya mencoba mencari cara untuk mematikan fitur post revision di wordpress. [...]

  13. [...] ??1????Disable Wordpress Autosave??2????Disable autosave ??3????How To Turn Off Post Revision In WordPress 2.6 ??2?4????Adjust WordPress Autosave or Disable It [...]

  14. Jimbo Says:

    What is the difference to this code?

    DELETE FROM wp_posts WHERE post_type = “revision”;

    which I found here?

    http://www.mydigitallife.info/2008/07/22/how-to-delete-existing-wordpress-post-revisions-storedsaved/

    Jimbo did not rate this post.
  15. Lester Chan Says:

    That code will only delete away the revisions but not the custom meta along with the revision.

    Lester Chan ratings for this post: Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5
  16. Jimbo Says:

    Lester Chan,

    Thanks but how do I know if my posts have any custom meta data or not? E.g. what other data is being stored in the ofter tables?

    Thanks,

    Jimbo

    Jimbo did not rate this post.
  17. Lester Chan Says:

    There is no way of knowing unless you know the IDs of the post.

    Lester Chan ratings for this post: Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5Lester Chan gives a rating of 5
  18. Poker Radio Says:

    Thanks! Just what I have been looking for!

    Poker Radio did not rate this post.
  19. Jurij Says:

    Dear Lester,

    THANK YOU VERY MUCH! I fullfill e-shop (of course without database backup on) and almost loose a 1 week work with “smart” revision function.

    THANK YOU AGAIN! Jurij Cvikl (Linkedln)

    Jurij did not rate this post.
 Page 5 of 5 « 1  2  3  4  5 

Leave a Reply