Spread the love

WordPress as an expert in the Blog platform provides multiple features like Autosaving, Saving the Previous versions. These are amazing features yet they consume certain space in the Database as every change is saved. An author cannot Judge at which revision he or she will get the expected content. It differs from person to person and case to case.

Revisions consume a lot of database resources. For better database optimization, WordPress provides 3 ways. We have explained all the three methods in a step by step procedure in this article.

Limit post revisions in WordPress

If you want the previous edits of the post or a page for reference but it should not consume more space, then you can limit the number of post revisions to be saved in the database by performing the following steps. Here, we are going to set the number of previous edits to be stored as 3.

  1. Go to WordPress installed Directory
  2. Open wp-config.php in any of your favourite text editor
  3. Add the following code,
define( ‘WP_POST_REVISIONS’, 3) ;

4. Save the changes and upload the same file to your WordPress installed Directory

Disable Post Revisions in WordPress

If you never want any of the Previous edits of your post or page to be saved you can completely disable the post revision saving feature by executing the following steps.

  1. Go to WordPress installed Directory
  2. Open wp-config.php in any of your favourite text editor
  3. Add the following code instead of the previous code used in the Limit Post revision topic, 
define( ‘WP_POST_REVISIONS’, false);

4. Save the changes and upload the same file to your WordPress installed Directory

Delete WordPress Post Revisions completely from the database

The above disable option does not delete the old Posts Revisions from your database. You can delete all the old posts revisions stored before enabling the limiting or disabling option completely if you want by performing the following steps.

  1. Go to phpMyAdmin
  2. Execute the following SQL Query,
global $wpdb:
$wpdb->delete( $wpdb->posts, array('post_type' => 'revision') );

Increasing Autosave time for posts in WordPress

WordPress has an autosave feature where it automatically saves your post at regular intervals while you are creating or editing that particular post. This feature consumes more of your server resources. By default, this Autosave feature saves the working post once in every minute. The time interval for the autosave option to be executed can be modified as every 5 or 10 minutes as per your convenience instead of 1 minute by executing the following steps.

  1. Go to WordPress installed Directory
  2. Open wp-config.php in any of your favourite text editor
  3. Add the following code,
define( ‘ AUTOSAVE_INTERVAL ’, 600); // seconds


4. Save the changes and upload the same file to your WordPress installed Directory

Post revision and Autosave features are provided for convenience for the users. We recommend you to follow the above techniques if you need to decrease the storage in your database. Share this with your mates and help them increase their site performance.

Leave a Reply