将此添加到您的函数中。php。
if ( !current_user_can( \'edit_users\' ) ) { //Change the edit_user" to whatever capability you need to retain the notifications
add_action( \'init\', create_function( \'$a\', "remove_action( \'init\', \'wp_version_check\' );" ), 2 );
add_filter( \'pre_option_update_core\', create_function( \'$a\', "return null;" ) );
}
或者,如果只想向特定用户显示通知,可以尝试以下操作:
global $user_login;
get_currentuserinfo();
if ($user_login !== "admin") { // change admin to the username that retains the notifications
add_action( \'init\', create_function( \'$a\', "remove_action( \'init\', \'wp_version_check\' );" ), 2 );
add_filter( \'pre_option_update_core\', create_function( \'$a\', "return null;" ) );
}