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.
 



(135 votes, average: 4.04 out of 5)
Thank you. You’re a life saver… Thanks again for proving sql query to delete the old revision posts.
[...] 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 [...]
hi, lester
the code within your post seems beautiful, how can I do that? use a code highlight plugins or manually edit css file?
I am using WP-Syntax, http://wordpress.org/extend/plugins/wp-syntax/
thanks, It is a nice plugin!
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 ?
it will still autosave, but it will not create the revisions
Thanks a lot, Lester! Disabling and then deleting all those revisions cut my db size in half!
Will it be the same if you just change the WP_POST_REVISIONS in wp-settings.php from true to false?
It is not recommended to touch the core files as you will lose them if you upgrade
I really need this post. I don’t know about this feature, usefull or useless..
Many thanks….
[...] 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. [...]
[...] ??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 [...]
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/
That code will only delete away the revisions but not the custom meta along with the revision.
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
There is no way of knowing unless you know the IDs of the post.
Thanks! Just what I have been looking for!
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)
THANK YOU..I mean it..
I just wonder why the wp core devs did not test this better. meta values are a core feature and the issue should have been plain to them before the release. Upgrading wp every heartbeat already is a pain (I have a heavily modified template and many customized features), but encountering these issues really makes me regret upgrading.
Again, thank you
Hi mate,
thanx for the explanation. It helped me a lot!
[...] you may “disable” the Matrix Easter Egg by turning off Post Revision In WordPress 2.6, which is the trigger point of showing this Easter [...]
Wow very useful post. I was not even aware of the fact that post revisions are taking up huge db space. I iwsh we had a plugin for it rather than modify the config file which even though easy requires more manual work.
A lifesaver! My problem was a little more serious than most in that I’m using an ECOMMERCE plugin for my client’s site that kept on attaching itself to a revision of the main products page. This fixed it. Thanks for a very helpful post.
Nice plugin! Thank for sharing
[...] ????????????? ??How To Remove WordPress Post Revisions ??http://iarematt.com/how-to-remove-wordpress-post-revisions ??????WordPress mu?PostRevisions?autosave?? ??http://feilong.org/disable-Remove-WordPress-mu-Post-Revisions ??How To Turn Off Post Revision In WordPress 2.6 ??http://lesterchan.net/wordpress/2008/07/17/how-to-turn-off-post-revision-in-wordpress-26 [...]
Remember guys - you can do this with the newly updated for WordPress 2.7 WP-CMS Post Control plugin over at http://wordpress.org/extend/plugins/wp-cms-post-control/
Whilst WordPress 2.7 gives some interface control to the write post and page panels, this plugin gives you COMPLETE control, also allowing you to turn off post revisions, auto save and even force the uploader back to the old browser one instead of Flash (this solves a-lot of problems for people).
This update also covers all the new WordPress 2.7 interface features - for instance being able to hide the favorites dropdown in the header of the admin panel.
Thanks. Nice trick.
Thanks! This is really helpful.
Thanks…