The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Remove the WordPress Admin Bar for Non-Administrators

Shared by Amit Dholiya · October 15, 2026 · @show_admin_bar,manage_options

Back to Snippets

Steps

  1. Add the PHP code to your child theme’s functions.php file or the Code Snippets plugin.

  2. Save and activate the snippet.

  3. Log in as a non-administrator to verify the admin bar is hidden on the front end.

Hook Used

– show_admin_bar — Controls whether the WordPress front-end admin bar is displayed.

Type: WordPress Admin Customization

Output: Administrators can still see the admin bar, while users without the manage_options capability cannot.

Note: This only hides the front-end admin bar. It does not prevent users from accessing the WordPress dashboard if their account permissions allow it.

function custom_hide_admin_bar_for_non_admins( $show ) {
    if ( ! current_user_can( 'manage_options' ) ) {
        return false;
    }

    return $show;
}
add_filter( 'show_admin_bar', 'custom_hide_admin_bar_for_non_admins' );

Tested on

WordPress 6.8

Reported by the author on October 15, 2026. WPFolks has not verified this.

Not tested against WordPress 7.1.3. It may still work.

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