Limit or disable WordPress revisions - How to Disable Post Revisions in WordPress and Reduce Database Size

Limit or disable WordPress revisions - How to Disable Post Revisions in WordPress and Reduce Database Size

September 30, 2020 | 2 min read

WordPress provides revision control on any pages or posts that you create which allow you to go back and see previous edits that you’ve written over in the database. While this can seem like a great thing to have, over time it can lead to a lot of unessary overhead in your WordPress database.

For instance let’s say that you’ve previewed a post that you’ve been working on 7 or so times, each of those revisions you might have just changed around a word or two, or made some very minimal changes. However in the WordPress database you would now have 8 copies of your original post, the 1 main one and 7 revisions storing the full content of that past revision and not just the changes made since the last one.

If you need to decrease the size of your WordPress database, removing your post revisions is a great way to do it without sacrificing any actual content. To do this open the WordPress wp-config.php file and add the following configuration line to it above the “/* That’s all, stop editing! Happy blogging. */” line:

define('WP_POST_REVISIONS', false );

Doing this, however, will only tell your WordPress application to stop storing new post revisions. If you want to delete all the existing ones, it’s a good idea to use the Bulk Delete free plugin or a different one with similar functionalities. If you do not want to disable the WordPress revisions functionality entirely, you can set a limit on how many revisions should be saved. This is done by adding the following line in the wp-config.php file above the “/* That’s all, stop editing! Happy blogging. */” line:

define('WP_POST_REVISIONS', 3 );

In the above, you can substitute 3 with the limit of revisions you want to have for each post.