How to limit and disable post revisions in WordPress to maximize the site speed

Post revision is an excellent feature that WordPress offers, but some users may not like it as it consumes the database. Also, if someone is running a large website then it might slow down the website loading speed. If you are one of those users who have a limited database size or want to increase your website speed, then stay right here! In this article, we are going to let you know how to limit and disable post revisions in WordPress to maximize the site speed.

In the following steps, we will demonstrate how you could disable post revisions in WordPress post by modifying your wp-config.php.

Step 1.

Access the wp-config.php which is located in your WordPress root directory. You can access this file by connecting through C-Panel or FTP server. Later, we will also discuss an alternate option for accessing this file through a number of plugins which are available in WordPress plugin directory.

Step 2.

Add the following code anywhere in your wp-config.php. Before making any changes, we recommend you to take a backup or download this file to your computer.

define('WP_POST_REVISIONS', false );

The above code will simply disable the post revision feature, but if you want to limit the post revision number, then place the code instead.

define( ‘WP_POST_REVISIONS’, 1 );

This code will limit WordPress to only save your last 1 revision of each post or page and discard older revisions automatically. You can change the number 2, 3, 4…….by replacing as per your wish.

Step 3.

Now, save the file and exit. For those who are accessing it through FTP server then you have to upload this file to your root directory.

The above code will disable all future revisions, but it wouldn’t delete the past revisions that are already saved in your database. For those who wish to delete all previous revisions, then you need to visit PHPMyAdmin and run the SQL query.

DELETE FROM wp_posts WHERE post_type = "revision";

The above code will delete all previously saved post revisions stored in your Database.

If you are not comfortable with manual editing of your WP-Config File or somehow you are not having an access to your C-Panel, then you can probably opt for a plugin which gets your job done. Below are a couple of plugins available to do the same task.

  • Disable Post Revision: It is a simple but powerful plugin to disable revisions on posts and pages, thus help you to reduce the database size.
  • WP Revision Master: This is another great plugin that allows you to disable or limit post revisions for the entire website. You get an option to configure the limit for each post type, compare multiple revisions and trash all of them at once.
  • Limit Post Revision Network Option: This plugin is helpful for those who run a multisite network. This plugin can be useful to disable, limit revisions or set autosave intervals on all the connected sites.
  • WP-Config File Editor: If you are not having an access to your control panel but are comfortable with coding then you must try this plugin. This plugin can let you configure various values in the wp-config.php file using the web form or Raw Editor. An advanced WordPress user can modify WordPress memory, cache, database, post, debugging, multi-sites, security and many other parameters on your server.

Note: We don’t suggest you limit or disable post revisions in WordPress for your WordPress site. This tutorial is only for those who are in the situation where they need to reduce their database size or they want to maximize the website speed.

You can consider further reading how to speed up WordPress website performance easily.