roles ) && in_array( $role, $user->roles ) ) { if ( _mw_adminimize_current_user_has_role( $role ) && isset( $disabled_global_option_[ $role ] ) && is_array( $disabled_global_option_[ $role ] ) ) { $remove_admin_notices = _mw_adminimize_recursive_in_array( '.admin-notices', $disabled_global_option_[ $role ] ); } } } if ( $remove_admin_notices ) { return true; } return false; } /** * Remove different admin notices. */ function _mw_adminimize_remove_admin_notices() { remove_action( 'admin_notices', 'update_nag', 3 ); remove_action( 'admin_notices', 'maintenance_nag', 10 ); remove_action( 'admin_notices', 'new_user_email_admin_notice' ); remove_action( 'admin_notices', 'site_admin_notice' ); // @ToDo, if we will use this. // Catch all admin notices. /* add_action( 'admin_notices', function () { ob_start(); }, PHP_INT_MAX + 1 ); $adm_notices = trim( ob_get_clean() ); $adm_notices = preg_replace( '/(\sclass=["\'][^"\']*?notice)(["\'\s])/', '$1 inline$2', $adm_notices ); */ }