Skip to main content
Login Join
Snippet · PHP

Disable WordPress Admin Notifications for Non-Admins

Shared by Amit Dholiya · June 17, 2026

7 views
Back to Snippets

Many plugins display notices and promotional messages that can confuse clients. This snippet hides admin notices for non-admin users.

Steps

  1. Open your WordPress theme functions.php file.
  2. Add the code below at the end of the file.
  3. Save the file.
  4. Log in as an Editor or other non-admin role to test.

Done — plugin and WordPress admin notices will be hidden from non-admin users.

⚠️ Important update notices will also be hidden from non-admin users.

function hide_admin_notices_for_non_admins() {
    if (!current_user_can('administrator')) {
        remove_all_actions('admin_notices');
        remove_all_actions('all_admin_notices');
    }
}
add_action('admin_init', 'hide_admin_notices_for_non_admins');
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments