Created
May 17, 2022 21:56
-
-
Save nfsarmento/0f10697f99da53a36fc9e845a67f4ac7 to your computer and use it in GitHub Desktop.
Disable admin notices In WordPress for all users apart from the the ID define on the Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* How To Disable Admin Notices In WordPress | |
* | |
*/ | |
add_action('admin_enqueue_scripts', 'os_admin_theme_style'); | |
add_action('login_enqueue_scripts', 'os_admin_theme_style'); | |
function os_admin_theme_style() { | |
$super_admins = array( 5 ); | |
if( ! in_array( get_current_user_id(), $super_admins ) ){ | |
echo '<style>.update-nag, .updated, .error, .is-dismissible, .notice-warning, .notice { display: none !important; }</style>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment