代码实现 关闭后台自动更新功能

代码实现 关闭后台自动更新功能

1
https://www.91wordpress.com/934.html

1. 关闭后台更新提示
切换到主题目录,打开functions.php文件,加入以下代码:

1
2
cd /home/wwwroot/default/vermaxcn/wp-content/themes/flatsome/
vi functions.php
1
2
3
4
5
6
7
//移除更新提示
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');

2. 关闭自动更新功能切换到网站根目录,打开config.php文件,加入以下代码:

1
2
cd /home/wwwroot/default/vermaxcn
vi wp-config.php
1
define( 'AUTOMATIC_UPDATER_DISABLED', true );

3. 重启 nginx

1
systemctl restart nginx.service

4. 已成功,后台 修改前后对比

Leave a Reply

Your email address will not be published. Required fields are marked *