How to Restrict or Disable Post Revisions

WordPress Post Revisions can take up a huge chunk of your Database (depending on how many Revisions you have for each Post.

Starting with version 3.5, WordPress implemented a new “revision” system whereby users could revert up to 25 different previously saved versions of their existing post. They could then compare the differences between any two of them, see what changed, and restore an earlier version at any point of time. This revisions feature is distinct from the default “autosave” which is always just one copy.
Over a period of time, these revisions get saved in the WordPress database and clutter it up. Some would like to keep their database neat and tidy and don’t like unnecessary bloat. If you’re the kind of person who would rather not have it sitting in your back end in the first place, here’s how a couple of lines of code gives you complete control over the post revisions feature of WordPress.

Locating Revisions

In case you didn’t know where to find the post revisions for your articles, here’s how to view them. To start with, you need a post that has been saved with changes at least once. Without that, the option to display post revisions won’t even show up. Once you’re on such a post, head over to the “Screen Options” section at the top of the page and hit the downward pointing arrow to expand the list of checkboxes.


As you can see in the screenshot above, one of them will be labeled “Revisions” and when you enable the checkbox, it creates a list of existing post revisions at the bottom of the screen. You can also view the total number of revisions on the box on the right-hand side of the post editor.

This number can swell to a staggering 25 revisions if I’m not careful. However, this can easily be controlled with one or two lines of code in your wp-configuration file. So what I’m going to do is I’m going to instruct WordPress to save only the two most recent post revisions. In my mind, this creates a good balance between having a safety net and storing a lot of useless information in the database.

Limiting Revisions

The variable I’m interested in is called “WP_POST_REVISIONS” and I’m going to set it in my wp-config.php file. So I open it up via my favorite FTP program and paste the following into it near the top before I declare my database parameters:

// Don't keep more than 2 post revisions
define ('WP_POST_REVISIONS',2);

When I save wp-config.php, this will instruct WordPress to keep only two revisions. To check and see if it’s working, I reopen the article with three existing post revisions earlier.

Disabling Revisions

If however, you want to do away with post revisions entirely, we simply set the variable to zero or “false”. In which case, the two lines above become:

// Disable post revisions entirely
define ('WP_POST_REVISIONS',false);
As you can see, as long as you have access to your wp-config.php file, you have complete control over the behavior of post revisions in WordPress. Personally, I prefer to limit them as in the first step as opposed to disabling the feature entirely.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.