After upgrading to a new version of WordPress, the Gutenberg editor was introduced. The code you previously used to disable auto-save and revision versions may have become ineffective. This article shares the official WordPress recommended
Method to Disable Revision Versions and Auto-Save。
What are WordPress Revision Versions and Auto-Save

If you are using the Gutenberg editor, you will notice that an additional revision version appears after clicking the save draft button once. If you are using the older classic editor, you will also find that it auto-saves every minute, creating another revision version. The revision version looks like the image below.

In some cases, this revision version and auto-save feature are useful. However, in most cases, auto-save and revision versions are unnecessary. Over time, your database will retain a lot of revision version data, causing database bloat and thereby
affecting WordPress performance speed. Therefore, when revision versions and auto-save functionality are not needed, we can disable WordPress post revision versions and auto-save functionality.
Official Recommended Method to Disable Revision Versions and Auto-Save
By default, WordPress has a WP_POST_REVISIONS function for post versions. WP_POST_REVISIONS is used to control whether revision versions are displayed. We can set the revision version functionality by inserting relevant code into the WordPress configuration file wp-config.php.
//禁用WordPress修订版本
define( 'WP_POST_REVISIONS', false );
WP_POST_REVISIONS has three default values: true (default), -1: indicates storing every revision version. false, 0: does not store revision versions (except for one auto-save version per post). A value greater than 0: sets the number of revision versions to save; previous versions will be deleted. So we also need to disable auto-save. WordPress defaults to auto-saving periodically (though Naiba tested in the new Gutenberg editor and found that revision versions only appear when manually saving, no auto-save was found; auto-save was found in the classic editor).
Method to Disable Auto-SaveInsert this code snippet into the wp-config.php file to set the auto-save time interval.
define( 'AUTOSAVE_INTERVAL', 160 ); // 修改自动保存间隔时间为160秒
We can modify the value of 160 to set the auto-save interval. Setting it to 86400 means auto-saving the article once a day. It is believed that within such a long time, your article will have already been published, effectively disabling WordPress's auto-save function. Insert the above code above /* That's all, stop editing! Happy publishing. */ in the wp-config.php file to take effect. The above method comes from
official documentation.。
Method to Clean Up Revision Version and Auto-Save Data
If your WordPress has already saved many revision versions and auto-save data, you can use
WP-Optimizeto clean up and optimize your database. If you are using
WP Rocketthis caching plugin, you can also clean up unnecessary database files in the settings.
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.