禁用 WordPress 更新检测和自动更新功能

每次打开后台,WordPress会启动更新检测和自动更新功能,检查程序、主题和插件是否有新版本,但国内一直无法顺畅的连接 WordPress 更新服务器,可能这就是经常有人说WordPress慢的原因了,这个锅不在WordPress。

禁用 WordPress 更新检测和自动更新功能

可以通过下面的代码禁用WordPress更新检测和更新功能,加快后台打开速度。

将下面代码添加到当前主题functions.php中:

// 彻底关闭自动更新
add_filter('automatic_updater_disabled', '__return_true');
// 关闭更新检查定时作业
remove_action('init', 'wp_schedule_update_checks');
// 移除已有的版本检查定时作业
wp_clear_scheduled_hook('wp_version_check');
// 移除已有的插件更新定时作业
wp_clear_scheduled_hook('wp_update_plugins');
// 移除已有的主题更新定时作业
wp_clear_scheduled_hook('wp_update_themes');
// 移除已有的自动更新定时作业
wp_clear_scheduled_hook('wp_maybe_auto_update');
// 移除后台内核更新检查
remove_action( 'admin_init', '_maybe_update_core' );
// 移除后台插件更新检查
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'load-update-core.php', 'wp_update_plugins' );
remove_action( 'admin_init', '_maybe_update_plugins' );
// 移除后台主题更新检查
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'load-update-core.php', 'wp_update_themes' );
remove_action( 'admin_init', '_maybe_update_themes' );

可根据自己的需要选择添加上述代码。

注:以上代码来自网络多年以前的,在新版WP中可能已失效,经测试后会陆续更新。

作者: xiaopan

Because there are people who love me and who I love.

为您推荐

发表评论

电子邮件地址不会被公开。 必填项已用*标注

评论列表 6人参与

  1. Getting in touch with your doctor, in reality, is the very first point you are supposed to do before starting to take Tadalafil. It's very well endured with such small adverse effects as muscle and back pain, headache, facial flushing, indigestion and looseness of the bowels. You will have to let your medical professional understand you have hypertension, breast pain, several myeloma, heart failing, liver or renal system troubles, reduced blood stress, a hatred Cialis, stroke, sickle cell anemia, a past of a cardiovascular disease, retinitis pigmentosa, intense vision loss, irregular heart beats, leukemia or deformed penis form among other health and wellness problems, as those could hamper your successful treatment somehow rendering it not as efficient as you expected. You can go over any type of contraindications you might need to stay clear of unsafe health impacts. The adhering to medications must be reported before you begin taking tadalafil singapore: antifungals, prescription antibiotics, blood, doxazosin or heart pressure medicines, HIV/AIDS medicine, conivaptan, imatinib, diclofenac, antidepressants, rifampin, seizure, and isoniazid medications.

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部