Limit or Disable Wordpress Revisions

Page content

How to limit or completely disable the number of revisions in Wordpress

Wordpress offers an in-built revisions feature that allows you to turn back to a post version you have saved previously. It can be a useful feature that if you ever want to turn back to a previous version, you can restore that revision.

At some point, everyone may find this feature useful. However, this feature can also add extra overhead to your Wordpress database since every revision gets stored in the database like a new post.

So, you will end up having several versions of the same post in the database which may affect database size and speed. Therefore, a large number of people prefer to completely disable or just limit the number of revisions in Wordpress.

In most cases, you will not need to keep more than 2 revisions in the database. The default number of revisions in Wordpress is not limited and so you will need to limit it to make sure that Wordpress is not storing several revisions of each post.

This can be performed either using a plugin that limits the number of Wordpress revisions or by limiting the number of revisions in Wordpress through the wp-config.php file. If you don’t want to make changes inside the wp-config.php file, you can use a plugin to achieve the same.

Wordpress autosaves revisions as you make them in Wordpress before updating a post. However, if you do not want Wordpress to frequently autosave revisions, you can also increase the autosave interval using the same process.

In this post, we will show you how to disable or limit Wordpress revisions through the wp-config.php file or using a dedicated plugin.

Limit the number of Wordpress revisions using wp-config.php file

You can easily limit the number of Wordpress revisions using the wp-config.php file. The wp-config.php file is a core wordpress file that is important for Wordpress functionality and which includes database credentials as well as other settings crucial to the working of Wordpress.

You will need either SSH access or FTP access to your server to open and edit the wp-config.php file. After that you can add just one line of code to limit the number of Wordpress revisions.

To change the number of revisions in Wordpress, we will use the wp_post_revisions settings in the wp-config.php file. For example, we will set the maximum number of post revisions to be stored by Wordpress to 3 only.

SSH to your server and go to the root folder of your website. Now, edit the wp-config.php file and add the following code before where it says - That’s all, stop editing! Happy publishing.

define('WP_POST_REVISIONS', 3);

You can change the number to anything that you want according to your choice. Just remember that you do not want too many revisions stored in the database and 2-3 revisions are generally more than sufficient.

DIsable the number of Wordpress revisions wp-config.php file

If you have too many posts and pages in your wordpress website, it will lead to too many revisions accumulating in your database which will hurt Wordpress performance. You can either limit the number of revisions or if you like you can completely disable this feature by simply setting it to false. However, before doing that, please note that in this case, Wordpress will not store any revisions and you will not be able to revert any posts to their previous versions.

If you still want to completely disable revisions in Wordpress, just add the following code before the line where it says “That’s all, stop editing. Happy Publishing!”

define('WP_POST_REVISIONS', false);

Limit or disable Wordpress revisions using a plugin

There are also a few very good plugins to limit or disable Wordpress revisions. One of the best plugins to limit or disable Wordpress revisions is the Perfmatters plugin. It is a premium performance optimization plugin for Wordpress that allows you to disable several scripts and features in Wordpress which can hurt speed and performance. It also allows you to optimize Wordpress heartbeat and to limit the number of revisions being stored in the Wordpress database.

Perfmatters a is a premium plugin so you will need to purchase a subscription. Download the plugin and upload it to your plugins folder or upload to your wordpress dashboard by adding a new plugin. Now, go to the plugin settings and from there, go to limit post revisions. Select the number of revisions you want to keep and then save the settings.

limit Post Revisions

Do not use both the plugin and the wp-config,php settings at the same time since that will cause an error. Use either the plugin or change the settings via the wp-config.php file. If you do not want to buy a premium plugin, you can also try ‘disable post revision’ plugin.

Suggested Reading

How to install themes in Wordpress

How to update or delete themes in Wordpress

Manage SEO with Rank Math Plugin

Disable comments globally in Wordpress

An Introduction to wp-config.php file

Plugins to Speed up Wordpress