Limit WordPress Revisions


Soo Many Revisions

WordPress revisions are a great feature that let you revert back to a previous version of a post or page, but by default it does not limit the amount of revisions that it keeps. This causes your database to get cluttered with multiple copies of each post or page as well as a nice long list of revisions at the bottom of the edit page. So what can you do to limit or even stop this behavior? Thankfully the folks at WordPress have given us some options.

Plugins Available

There are many plugins available in the WordPress plugin repository that give you an easy way to set a limit or disable revisions, but the simplest and actively maintained plugin is simply called WP Revisions Limit. After installing the plugin, navigate to Settings -> Revisions Limit, set a value and you’re done.

WP Revisions Limit Settings

Download WP Revisions Limit

Developer Options

There are 2 different ways for a developer to implement a restriction on the amount of revisions to store. The first method will set a global limit and is good for site owners that want a simple one stop shop to limit or disable revisions; the second better suited for plugin or theme developers that want to control specific post types.

Define Method

To globally disable or limit all revisions regardless of post type you can add the following line of code to your wp-config.php file.

This will set a global limit of 5 revisions per post.

The supported values are:

  • true or -1: No limit on revisions (default option)
  • false or 0: Do not save any revisions (does not include autosave)
  • integer greater then 0: save the amount you specify (+1 autosave)

Filter Method

This method is great if you want to limit the amount of revisions on a specific post type or if you don’t have access to wp-config.php. You can use the wp_revisions_to_keep filter as seen in the 2 examples below.

This will set a global limit on revisions just as setting the limit in the wp-config.php file would do.


Here we are setting a limit only on the post_type of ‘my_custom_post_type’, and leaving the rest to use the system default.

Don Gordon has written 1 article

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">