If you gave wp-admin access to some users as editor or contributor etc, they will see those WordPress admin notices, even though those notices are mostly meaningless for them. Not ideal for end users, and often can be confusing. So we will turn off all admin notices for non-admin users from wp-admin dashboard. We will remove all admin_notices
with the help of remove_all_actions
function. We will also remove core_update_footer
from update_footer
to remove that update notice in footer.
function careless_hide_all_admin_notices_from_non_admin_users() {
if ( !current_user_can( 'manage_options' ) ) {
remove_all_actions( 'admin_notices' );
remove_filter( 'update_footer', 'core_update_footer' );
}
}
add_action( 'admin_head', 'careless_hide_all_admin_notices_from_non_admin_users', 1 );
Code goes in the functions.php
file of your active theme.
If you want to only remove update notices, you should follow this article instead.