虽然一直都推荐将WordPress核心、主题和插件更新到最新版,但有时更新以后,可能造成网站原本的某些功能无法正常使用。可是如果你不更新,后台就一直显示更新提示,看着总是碍眼。要隐藏这些提示,将下面的代码添加到主题的 functions.php 即可:
/**
* 隐藏核心<a href="https://www.wpdaxue.com/tag/%e6%9b%b4%e6%96%b0%e6%8f%90%e7%a4%ba" title="查看与【更新提示】相关的文章" target="_blank" rel="noopener">更新提示</a> WP 3.0+
* 来自 https://wordpress.org/plugins/disable-wordpress-core-update/
*/
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
/**
* 隐藏插件更新提示 WP 3.0+
* 来自 https://wordpress.org/plugins/disable-wordpress-plugin-updates/
*/
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$b', "return null;" ) );
/**
* 隐藏主题更新提示 WP 3.0+
* 来自 https://wordpress.org/plugins/disable-wordpress-theme-updates/
*/
remove_action( 'load-update-core.php', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$c', "return null;" ) ); |
/**
* 隐藏核心<a href="https://www.wpdaxue.com/tag/%e6%9b%b4%e6%96%b0%e6%8f%90%e7%a4%ba" title="查看与【更新提示】相关的文章" target="_blank" rel="noopener">更新提示</a> WP 3.0+
* 来自 https://wordpress.org/plugins/disable-wordpress-core-update/
*/
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
/**
* 隐藏插件更新提示 WP 3.0+
* 来自 https://wordpress.org/plugins/disable-wordpress-plugin-updates/
*/
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$b', "return null;" ) );
/**
* 隐藏主题更新提示 WP 3.0+
* 来自 https://wordpress.org/plugins/disable-wordpress-theme-updates/
*/
remove_action( 'load-update-core.php', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$c', "return null;" ) );
以上代码仅支持 WP 3.0+ 版本,如果你使用的是3.0以前的WordPress,请下载代码中提到的插件。
来源:
https://www.wpdaxue.com/disable-wordpress-updates.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_32447.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57