如果不想会员或者客户在后台看到你的WordPress更新通知,我们可以直接禁用他们,今天就分享一下设置非管理员禁止显示WordPress更新通知方法。

当然wordpress管理员是可以看见的,其他用户是不能看见wordpress更新的通知。

把下面的代码到你当前的WordPress主题functions.php文件:

if ( !current_user_can( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’manage_options\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ ) ) {

//Disable Theme Updates

remove_action( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’load-update-core.php\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_update_themes\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ );

add_filter( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’pre_site_transient_update_themes\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, create_function( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’$a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”return null;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\” ) );

wp_clear_scheduled_hook( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_update_themes\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ );

//Disable Plugin Updates

remove_action( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’load-update-core.php\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_update_plugins\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ );

add_filter( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’pre_site_transient_update_plugins\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, create_function( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’$a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”return null;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\” ) );

wp_clear_scheduled_hook( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_update_plugins\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ );

//Diasable Core Updates

add_filter( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’pre_site_transient_update_core\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, create_function( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’$a\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”return null;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\” ) );

wp_clear_scheduled_hook( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’wp_version_check\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ );

}

相关新闻

发表评论

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

联系我们

联系我们

151-1101-0018

在线咨询:
邮件:30115776@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
关注微信
分享本页
返回顶部