👋🏼Welcome to my WP-Host blog where I am excited to share my knowledge and expertise on WordPress hosting and website construction tutorials with you. Let’s connect and learn from each other! You can reach me at info@yrshare.com.

(如果你会中文,可以点击微信图标与我联系。)

扫一扫加我

注:因个人英文水平有限,所以暂时只能为懂中文的朋友提供wordpress建站服务

微信:18200592859 或 yrwordpress

WordPress disable or clean revisions with autosave

WordPress disable or clean revisions with autosave-WP-Host

WordPress disable or clean revisions with autosave: By default, WordPress saves a draft or revision every 1 minute. Over time, this results in a large number of IDs being occupied by these drafts, causing many of our article IDs to be non-consecutive and have gaps in between. Furthermore, this leads to accumulation of database junk over a long period of time, ultimately affecting the website’s loading speed. In the following text, I will provide several solutions to address this issue.

【WP-Host/悦然wordpress建站】

Users who use wordpress to build a website may love or hate the built-in modified version and automatic draft function. These two functions are actually quite useful, especially the automatic draft function. If you accidentally close the webpage while writing an article, you can directly find the article you just wrote in the draft. But most users still don’t like it, so you might consider turning it off.

Method 1

If you don’t want the wordpress site to automatically save or produce a modified version when writing an article, you can use the following code to disable it.

code 1

//禁用文章自动保存
add_action('wp_print_scripts','disable_autosave');
function disable_autosave(){
wp_deregister_script('autosave');

code 2

//禁用文章修订版本
add_filter( 'wp_revisions_to_keep', 'specs_wp_revisions_to_keep', 10, 2 );
function specs_wp_revisions_to_keep( $num, $post ) {
return 0;

把上面的代码添加到当前wordpress主题模板的function.php文件中保存即可生效,以后你的网站都不会产生修订版本和自动保存草稿了。

Method 2

WordPress disable or clean revisions with autosave-WP-Host

Directly disabling revisions and auto-saving is actually not a very good way, because these two functions are quite useful, as long as we can clean up useless revisions and auto-save in time, so we can use wordpress plug-ins to
To achieve this effect, the plugin recommended here is WP-Optimize.

WP-Optimize

https://wordpress.org/plugins/wp-optimize/
WordPress disable or clean revisions with autosave-WP-Host

After installing the WP-Optimize plugin, revisions and autosaves can be cleaned up separately in the settings.

使用wordpress建站的用户可能会对自带的修改版本和自动草稿功能又爱又恨。这两个功能其实都是比较有用的,特别是自动草稿功能,如果你写文章时不小心把网页关闭,你可以直接在草稿中找到刚刚撰写的文章。但大多数用户还是不喜欢它,所以你可以考虑关闭。

方法一

如果您不想让wordpress站点在写文章时自动保存或生产修改版本,可以使用以下的代码来禁用。

代码1

//禁用文章自动保存
add_action('wp_print_scripts','disable_autosave');
function disable_autosave(){
wp_deregister_script('autosave');

代码2

//禁用文章修订版本
add_filter( 'wp_revisions_to_keep', 'specs_wp_revisions_to_keep', 10, 2 );
function specs_wp_revisions_to_keep( $num, $post ) {
return 0;

把上面的代码添加到当前wordpress主题模板的function.php文件中保存即可生效,以后你的网站都不会产生修订版本和自动保存草稿了。

方法二

WordPress disable or clean revisions with autosave-WP-Host

直接禁用修订版本和自动保存其实算不上太好的办法,因为这两个功能还是比较有用的,我们只要能够及时的清理无用的修订版本和自动保存就可以了,所以我们可以使用wordpress插件来达到这样的效果,这里给大家推荐的插件是——WP-Optimize。

WordPress disable or clean revisions with autosave-WP-Host

安装好WP-Optimize插件之后可以在设置中对修订版本和自动保存进行单独清理。

WordPress Hosting / 悦然wordpress建站

WordPress Hosting / 悦然wordpress建站

【WordPress Hosting / 悦然wordpress建站】I am a WordPress hobby from China, and I like to communicate with friends from all over the world to learn WordPress website building and maintenance related knowledge.