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.
 




(111 votes, average: 3.92 out of 5)
July 17th, 2008 at 02:05
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!
July 17th, 2008 at 02:16
You are most welcome =)
July 17th, 2008 at 02:45
Thank you! I have the same problem
before reading your post, I guess someone’ll create a plugin to cut this feature
July 17th, 2008 at 05:21
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
July 17th, 2008 at 11:14
Thank you. You’re a life saver…not the little mint candy kind.
July 17th, 2008 at 12:10
[...] if you are having issues with your Organize Series Plugin after the big WordPress upgrade check out Lester Chan’s blog for instructions on how to fix the issue. Series Navigation« Share and Enjoy: These icons [...]
July 17th, 2008 at 12:16
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!!
July 17th, 2008 at 12:18
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.
July 17th, 2008 at 15:03
Thanks you for the compliments =D
July 17th, 2008 at 15:06
[...] Lester Chan. digg_url = [...]
July 17th, 2008 at 16:29
[...] ??? ????????? ?????????? ???????? ??????? ? WordPress 2.6 17 ???? 2008 ? 12:35 ?????: ???? ???????: Wordpress ?????: ??????? ???????? ?????? ?? ??????????: How To Turn Off Post Revision In WordPress 2.6 [...]
July 18th, 2008 at 06:03
[...] ???? ? ?? ???????? ???? ??? ? ?? ???? ???? ?? [...]
July 18th, 2008 at 13:25
[...] conforme Lester Chan, existem algumas providências que podem ser tomadas. A primeira delas, alterar o intervalo de [...]
July 18th, 2008 at 20:32
nice list.
July 18th, 2008 at 21:15
[...] Tiedot löytyivät WordPressin foorumilta, ja myös kätevästi koottuna Lester Chanin blogimerkinnästä How To Turn Off Post Revision In WordPress 2.6. [...]
July 19th, 2008 at 05:04
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.
July 19th, 2008 at 06:57
Awesome! That did the trick! Thank you.
July 19th, 2008 at 12:03
[...] application is limited. This was just a terribly thought out “feature.” Fortunately, it can be disabled and auto save can be set to a reasonable value. Why this isn’t something that can be set in [...]
July 19th, 2008 at 14:10
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…
July 20th, 2008 at 00:32
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.
July 20th, 2008 at 13:41
[...] "features" directly through the admin panel. If you want to turn them off, you have to edit the wp-config.php file, which is almost akin to editing the registry in Windows - if you mess something up, you could [...]
July 20th, 2008 at 15:31
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?
July 20th, 2008 at 17:17
@Jonathan Yea, WP is getting bloated
@Travis I don’t think it will delete after a certain period
July 20th, 2008 at 20:20
[...] was not there, I was just looking for a way to disable this feature. I stumbled upon this cool solution from Lester [...]
July 20th, 2008 at 22:33
Thank you!
July 21st, 2008 at 00:34
Thanks for the fix.
July 21st, 2008 at 02:25
[...] Another Followup: Lester Chan is correct in saying that Post Revisions in Wordpress have very little utility and clutter up the [...]
July 22nd, 2008 at 02:42
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
July 23rd, 2008 at 05:28
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!
July 23rd, 2008 at 06:46
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.
July 23rd, 2008 at 10:27
[...] ??????? : How To Turn Off Post Revision In WordPress 2.6 [...]
July 23rd, 2008 at 14:09
[...] La solución completa la encontré en: How To Turn Off Post Revision In WordPress 2.6 [...]
July 23rd, 2008 at 14:30
@Ryan Boren, @noname : Yea I confirm that auto save does not create a revision. My bad.
July 23rd, 2008 at 14:58
Just a heads up: I wrote a plugin which allows some control over the post revisions (Disabling in admin, Enabling on per post basis, limiting number of revisions, etc): http://dd32.id.au/wordpress-plugins/revision-control/
PS. @validation function: ‘ ‘ is a valid character in an email address
July 23rd, 2008 at 14:59
Oh.. It doesnt like the plus symbol at alll.. Lovely
July 23rd, 2008 at 15:25
@DD32: Nice! WordPress should have that in the core.
July 23rd, 2008 at 17:03
[...] Rozwi?zania doszuka?em si? na blogu Lestera. Trzeba przyzna?, ?e jest ono balane i nie wymaga zbyt du?ej znajomo?ci programistycznej. [...]
July 23rd, 2008 at 18:03
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.
July 23rd, 2008 at 18:39
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).
July 23rd, 2008 at 22:22
[...] More details: Refer to http://lesterchan.net/wordpress/2008/07/17/how-to-turn-off-post-revision-in-wordpress-26/ [...]
July 24th, 2008 at 16:06
Don’t put it at the end of wp-config.php or it won’t work.
July 24th, 2008 at 22:58
Can’t believe this bloody thing is a feature! Thanks for the help
July 25th, 2008 at 00:09
This must be a sore spot at Wordpress software central.
Comment from support: “First question: Why do you think that it matters how many posts/pages/revisions/whatever are in the database? Databases are fast and efficient, and text compresses easily, you know.”
http://wordpress.org/support/topic/191420?replies=1#post-812141
July 25th, 2008 at 03:44
[...] what about those revisions left in your database? Several posts look as if they found the true answer, but it’s one of those “The one who laughs [...]
July 25th, 2008 at 04:11
[...] Lester Chan hat die Lösung [...]
July 25th, 2008 at 04:11
Thanks for fix!!! I cannot believe WP guys came up with this “feature” and did not announce how to fix it…
July 25th, 2008 at 10:22
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);
July 25th, 2008 at 16:45
[...] title says it all. This page describes how to do it and to stop the wp_posts table filling up with multiple copies of the same [...]
July 25th, 2008 at 17:17
@oldengine: Both is the same thing as false is equals to 0 as well.
July 26th, 2008 at 05:51
thank you,
this was helpful!
July 27th, 2008 at 20:51
Where do I put the snippet of code in the wp-config.php file??
July 27th, 2008 at 21:56
[...] to Lester Chan for highlighting the config settings for turning off revisioning and for modifying the autosave [...]
July 27th, 2008 at 21:58
After
define('DB_COLLATE', '');should be fine.July 28th, 2008 at 21:46
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.
July 29th, 2008 at 01:18
Hi Brian, thanks for the compliments. I think the Revision Control plugin is from dd32 and is inspired by this post =D
July 29th, 2008 at 22:12
[...] off, follow the mighty Lester Chan’s advice to turn off post revisions. You can also use the SQL he’s posted to delete revisions [...]
July 30th, 2008 at 01:55
[...] How To Turn Off Post Revision In WordPress 2.6: Lester Chan shows you how to turn of Post Revision in WordPress 2.6. In my opinion, the best new feature in WordPress 2.6 is Post Revision support. That said, some people do not like it because it creates full copies of your post on every save, thus leaving unneeded garbage behind. [...]
July 30th, 2008 at 11:37
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’
July 30th, 2008 at 14:19
@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?
July 30th, 2008 at 20:41
It came from here:
http://andreineculau.com/blog/2008/07/delete-wordpress-26-revisions/
I was just looking to see if this was a recommended procedure. (My database is a mess of revisions and it needs a complete cleaning.)
July 30th, 2008 at 23:09
@oldengine Thanks, I have updated the code.
July 31st, 2008 (5 weeks ago) at 01:44
One small correction I’ve made just now –
DELETE a,b,c
July 31st, 2008 (5 weeks ago) at 01:52
Thanks updated =D
July 31st, 2008 (5 weeks ago) at 05:21
July 31st, 2008 (5 weeks ago) at 23:25
[...] finally, Lester Chan offers a way to delete the revisions that have already been [...]
August 3rd, 2008 (4 weeks ago) at 02:48
My WP-CMS Post Control plugin allows you to control post revisions and auto saving in WordPress over at It also allows you to take control of all aspects of your WordPress write post/page panels, so you can control the visibility of the more confusing items such as hiding post revisions, but still keeping them active!
August 4th, 2008 (4 weeks ago) at 22:53
I just did it, and removed about 80 additional posts I won’t need.
Thanks for the very clean fix!
August 5th, 2008 (4 weeks ago) at 03:01
[...] points to good advice from Lester Chan to ensure that you don’t fill up your wordpress revision [...]
August 6th, 2008 (4 weeks ago) at 21:38
Thanks a lot, this solved a blank page error when trying to edit a post I made after the upgrade. All the other articles
August 7th, 2008 (4 weeks ago) at 18:42
Same for me, thanks a lot, also it solved the blank page error when trying to edit a post and I don’t think it is very useful to have a revision of each post.
Also my provider only gives me 100Mb of mysql space and I think with a open public blog it will rapidly got out of space.
Thanks and bye
August 7th, 2008 (4 weeks ago) at 21:45
[...] que vi em dois sites (primeiro e segundo) pode-se facilmente desabilitar a revisão de posts adicionando a linha abaixo no arquivo [...]
August 10th, 2008 (3 weeks ago) at 10:26
[...] información la he sacado fundamentalmente de esta web y juraría que también se habló de ello en Ayuda Wordpress, pero me ha sido imposible encontrar [...]
August 10th, 2008 (3 weeks ago) at 20:39
Thanks was looking for the option. Just wanting to mention the post is highly appreciated.
August 11th, 2008 (3 weeks ago) at 04:43
[...] WordPress guru Lester Chan found a way. An edit to the wp-config file turns off post [...]
August 12th, 2008 (3 weeks ago) at 04:35
[...] a database full of revisions, you can get rid of them. Lester Chan outlines a nice and easy way to remove the old revisions from your [...]
August 13th, 2008 (3 weeks ago) at 15:35
Phew! You just saved my day with this hack.
August 15th, 2008 (3 weeks ago) at 09:10
Awesome! I have been deleting the “iframe - malware” stuff and each time I deleted a visible iframe, I was auto-saving/revisions the hidden iframe. Your just helped me “clean” my site, Thanks! Now Google will release me.
August 17th, 2008 (2 weeks ago) at 17:32
[...] How To Turn Off Post Revision In WordPress 2.6 is the answer to how to disable. To turn it off, add the following code to [...]
August 18th, 2008 (2 weeks ago) at 13:14
Hi Lester,
Those of us that ran the original “Delete” as recommended by Andrei Neculau would now have orphaned records in the term_relationships and postmeta tables.
Any suggestions?
R
August 18th, 2008 (2 weeks ago) at 13:42
Thank you for this info. Post revisions consume a lot of my database space, so I have to turn it off otherwise I’ll run out of my hosting space.
August 18th, 2008 (2 weeks ago) at 14:36
Hi Robert,
No idea whether this code works, you want to try to see if it returns any results first.
SELECT a,b,cFROM 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.id IS NULL
August 18th, 2008 (2 weeks ago) at 17:41
Hi Lester,
Thanks for responding so quickly.
I ran the code you noted above and got the following response:
#1054 - Unknown column ‘a’ in ‘field list’
Just as an aside and an added benefit to turning of post revisioning and also the automatically saving of posts is the CPU savings. Since turning off both - I am no longer getting penalised by my Hosting Provider for chewing up CPU cycles. A big plus!!
Cheers,
R
NB: I have been using your WP-DBManager and WP-PluginsUsed and they are tops!!
August 18th, 2008 (2 weeks ago) at 22:02
Ops my bad, try this code:
DELETE b, cFROM wp_term_relationships b LEFT JOIN wp_postmeta c ON (c.post_id = b.object_id) WHERE post_id IS NULL
I tested it, it should work