How to Disable or Limit Post Revisions in WordPress to Speed Up the Site

Share this

post revisions

Post revision is one of the excellent features I love in WordPress. It automatically saves opened contents on post editor at regular intervals. Hence you won’t lose any work even though you forgot to save it.

Writers can view the past revisions of their post from the Publish menu of WordPress editor.

Tap Browse, next to Revision numbers. It will open a screen like this,

 

Drag top scroll bar to the left or right to see all your revisions. If you want to go back to a previous version, choose it and tap Restore This Revision button on the top.

Post revision is a useful feature but has some demerits too. By default, there is no limit on the number of revisions to save. WordPress will start saving from the very first moment of your writing without any end time. Those figures may go beyond hundreds if you are not properly monitoring, managing the database. The website speed will decrease according to the size of database.

To overcome the situation, you have two options:

  1. Disable the post revisions entirely
  2. Limit the maximum number of post revisions

Disable post revisions in WordPress

To disable post revisions, follow these steps.

  • Open wp-config.php from the root directory of WordPress.
  • Enter the following code,
define( ‘WP_POST_REVISIONS’, false );

It will disable all post revisions on your site. However, I do not recommend this method as you won’t get any chance to recover a previous version of the post. Instead of disabling, you can set the maximum number of revisions or can configure the autosave intervals to control the database size.

Enable post revisions in WordPress

To enable post revisions again, enter this code.

define( ‘WP_POST_REVISIONS’, true );

This is the default structure in WordPress sites and will save revisions on each post change.

Limit post revisions in WordPress

If you want to set a maximum number for the revisions, add the following code in your website’s configuration file.

define(‘WP_POST_REVISIONS’, 5);

Now we defined maximum revisions per post as 5. Customize the figure according to your post frequency and total database size.

Set interval for post revisions in WordPress

Autosave interval is another method for managing revisions. Set an interval between two revisions like 120 seconds, 300 seconds etc.  This can be achieved by inserting the following tag in the same wp-config.php file. 

define('AUTOSAVE_INTERVAL', 300 );

300= 300 seconds or 5 minutes. Your post will be automatically saved in every 5 minutes. So you will get less number of revisions than before.

Plugin options

If you are afraid of touching root files, a couple of plugins are available to do the same task.

Disable Post Revision: a simple plugin to disable revisions on posts and pages, thus help you to reduce the database size.

WP Revision Master: It lets you disable or limit post revisions for the whole site, configure the limit for each post type, compare multiple revisions and trash all of them at once.

Limit Post Revision Network Option: It is a multisite network plugin to disable, limit revisions or set autosave intervals on connected sites.

WP-Config File Editor: This plugin is for advanced WordPress users to configure various values in wp-config.php file using web form or Raw Editor. It lets you modify WordPress memory, cache, database, post, debugging, multi-sites, security and many other parameters on your server.


Share this