方法一:修改配置文件(wp-config.php)
通过在 WordPress 的配置文件 wp-config.php 中添加代码,可以禁用更新功能,且不会影响后台加载速度。
禁用所有自动更新,在 wp-config.php 文件中添加:define(‘WP_AUTO_UPDATE_CORE’, false);
禁用主题和插件更新,添加代码:add_filter(‘pre_site_transient_update_themes’, ‘__return_null’); add_filter(‘pre_site_transient_update_plugins’, ‘__return_null’);
禁用核心更新,添加代码:add_filter(‘pre_site_transient_update_core’, ‘__return_null’);
禁用更新提醒,添加代码阻止通知邮件:add_filter(‘auto_core_update_send_email’, ‘__return_false’); add_filter(‘auto_theme_update_send_email’, ‘__return_false’); add_filter(‘auto_plugin_update_send_email’, ‘__return_false’);
操作步骤:找到 WordPress 根目录下的 wp-config.php 文件,使用文本编辑器打开,在文件末尾(?> 前)添加上述代码,保存并上传至服务器。
方法二:使用插件
如果你不熟悉代码,可以通过插件快速禁用更新。
推荐插件:安装并激活 “Disable All WordPress Updates”,该插件一键禁用所有更新(核心、主题、插件)及提醒,在 WordPress 后台的“插件”菜单中搜索并安装。
优点:操作简单,无需修改代码,不会影响后台加载速度。
方法三:修改主题的 functions.php 文件
如果只想调整当前主题,可以在 functions.php 文件中添加代码。
禁用所有更新,在 functions.php 中添加:
function remove_core_updates(){
global $wp_version;
return (object) array('last_checked' => time(), 'version_checked' => $wp_version);
}
add_filter('pre_site_transient_update_core', 'remove_core_updates');
add_filter('pre_site_transient_update_plugins', 'remove_core_updates');
add_filter('pre_site_transient_update_themes', 'remove_core_updates');
禁用更新提醒,添加代码:
add_filter('auto_core_update_send_email', '__return_false');
add_filter('auto_theme_update_send_email', '__return_false');
add_filter('auto_plugin_update_send_email', '__return_false');
操作步骤:在 WordPress 后台进入“外观” > “主题文件编辑器”,找到 functions.php,将代码添加至文件末尾,保存即可。
注意事项
安全性:禁用更新后,网站可能无法及时修复漏洞,建议定期手动检查并更新。
备份:在修改文件前,备份网站文件和数据库,以防操作失误。
测试:修改完成后,检查后台加载速度,确保正常。
总结
以上三种方法(修改 wp-config.php、使用插件、调整 functions.php)都能禁用 WordPress 更新及提醒,且不影响后台速度。熟悉代码的用户可选择方法一或方法三,追求简单的用户可选择方法二(插件方案)。