Customize WordPress Post Revisions
In a default install of WordPress, each time you edit a post or page, WordPress will automatically save your previous posts/pages allowing the possibility of reverting to a previous version of that post or page. This is a cool feature, but it can get a little ridiculous when you have dozens of previous versions sitting below the post–and taking up space in your db. As you can see in the following screenshot, with just a couple of edits to this post, I’ve already racked-up 4 revisions…by the time I finish editing, I’ll probably have a dozen or so…
Each of those revisions requires a separate record in the db. So, although this is a cool feature, it can significantly add to db bloat. If you don’t really care to have all those revisions sitting around, or if you want to limit the number, WordPress does provide an option to change the default behavior allowing you to either disable revisions completely or allowing you to limit the number of revisions saved. To make these changes you do need to edit your wp-config.php file directly…currently, there is no option for doing this in WP admin.
Disable Post Revisions
To completely disable the revisions feature, add (or if already present) edit the following code to your wp-config.php file. The word (false) disables this feature.
define('WP_POST_REVISIONS', false );
Specify the Number of Post Revisions
If you want to keep the revisions feature, but limit the number revisions saved, then use the same code as above, but change false to the number of revisions you want to keep. In the example below, WordPress will keep the latest 3 post or page revisions.
define('WP_POST_REVISIONS', 3);
Related posts:
- WordPress 2.9 Trash Feature — How to Customize In WordPress 2.9 one of the new features is the...
- How to Write a WordPress Post Note: The following is made available under GPL from http://codex.wordpress.org/GPL....



Just what I was looking for. Thanks!
Thank you very much, works great, and I have applied this trick.
Figaro, you probably should wrap those defines in PRE or CODE tags, because if you just copy/paste in UTF-8 environment those single quotes will go into wp-config.php as is and feature will not work. Just experienced this myself and wanted to let you know. Also WP will remove all of the old extra revisions once you save the article.
@Vagabond: Thanks for the tip.
this doesn’t seem to work on version 2.9.2. is there another way for this version?
@prash: It should work…works on my install.
You might also need to check the wp-settings.php file. Depending on where you put the new define statement, this file might override the define statement in the wp-config.php file.
@xenoactive: Are you saying these lines of code should be added to the wp-config.php file before or after the call to wp-settings.php? I’ve done an hours worth of reading to make sure I do this correctly and then you go and throw me a curve.
@Figaro: Thanks for the informative tutorial. this post is the last stop in my quest for fixing this ridiculous revisions issue WP has going on.
xenoactive has a point. It’s not in my wp_config.php either, it’s in my wp-settings.php file. May have been changed with newer installations of WP?
May be worth checking out to avoid confusion.
after 2.9.0 you need to put the line define(‘WP_POST_REVISIONS’, false ); into wp-settings.php before the wp_functionality_constants( ); function call…
I’m using WP3, and I was able to make this work by adding
define(‘WP_POST_REVISIONS’, false);
to my wp-config.php file. Initially it didn’t work, but I found it had to be added before the
require_once(ABSPATH . ‘wp-settings.php’);
line.
I wrote some more on this (and other tips) at
http://mikebeach.org/2010/07/optimizing-wordpress/