👋🏼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禁用或清理修订版本与自动保存

WordPress disable or clean revisions with autosave-WP-Host

Wordpress禁用或清理修订版本与自动保存:wordpress默认为1分钟自动保存一次,长期下来这些草稿或修订版本就占用生大量的ID号,从而导致我们的很多文章ID都不是连续的,中间有很多空缺。而且长时间下来网站数据库中会产生大量的垃圾,最终会影响网站打开速度。接下来我会给大家提供几个解决方法。

【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建站】我是来自中国的wordpress爱好,喜欢与世界各地的朋友一起交流学习wordpress建站和维护相关知识。