Back

How to Disable Autosave WordPress Feature and Post Revisions to Reduce Database Size

Spread the love

WordPress has a built-in autosave feature. This means that posts and pages are saved automatically every time you make a change, and you can’t go back to the previous version if something goes wrong if you have disabled the post revisions.

Disable Autosave WordPress feature for posts

Disable Autosave WordPress Feature for WordPress Posts

The autosave function is not always the most efficient way to work. Sometimes it can be better to disable the WordPress autosave feature in order to avoid unnecessary data loss.

In this article, we will show you how to disable autosave WordPress feature on your account so that you can work more efficiently with your WordPress content management system (CMS).

  1. Go to WordPress installed Directory
  2. Open wp-config.php in any of your favorite text editor
  3. Add the following code,
define( 'AUTOSAVE_INTERVAL', 86400); // 1 day

Setting an interval of 86400 seconds is a day, so the autosave interval will be set for a day, and the autosave functionality will not trigger for 24 hours, effectively disabling it.

Increasing Autosave time

Instead of disable autosave WordPress functionality, you can also increase the time of autosave.

The time interval for the autosave option to be executed can be also modified as every 5 or 10 minutes as per your convenience instead of 1 minute by executing the following steps.

define( 'AUTOSAVE_INTERVAL', 600); // seconds


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

WordPress Post Revisions

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 options 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 MySQL Query,
DELETE FROM wp_posts WHERE post_type = "revision";

wp_posts is the table name of where all WordPress will be saved and “wp_” is the table prefix. If you have set a custom table prefix on your installation, don’t forget to change the prefix before running the above MySQL query.

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

You May Also Read

How to Disable WordPress Auto Update email notifications Without using Plugin
How to easily translate WordPress Plugin using Poedit
How to easily translate WordPress theme using Poedit to another language

Leave a Reply

Your email address will not be published. Required fields are marked *