This snippet removes all admin notices and dashboard notifications for users with the Editor role in the WordPress admin panel. It helps create a cleaner and distraction-free admin experience by hiding plugin, theme, and core notices from editor-level users.
/**
* Hide all WordPress admin notices for editor users.
*
* Removes plugin, theme, and core admin notices from the dashboard
* for users who have the Editor capability to provide a cleaner
* admin experience.
*
*/
function sj_hide_admin_notices_for_editors() {
// Check if the current logged-in user has editor access.
if ( current_user_can( 'editor' ) ) {
// Remove all admin notice actions.
remove_all_actions( 'admin_notices' );
remove_all_actions( 'all_admin_notices' );
}
}
add_action( 'admin_init', 'sj_hide_admin_notices_for_editors' );