How to Hide the WordPress Admin Bar for Non-Admin Users

Hide the admin bar for clients and subscribers while keeping full access for admins in minutes.

Hide the WordPress admin bar for non-admin users with a small code snippet that checks capability and turns off the bar. Add a filter on `show_admin_bar` that returns false for anyone who cannot manage site settings.

The admin bar is the dark toolbar at the top of the screen for logged-in users. It shows shortcuts to the dashboard, profile, and site actions. Hiding it cleans up the front end for subscribers, clients, and members.

Table of Contents

What Is the Fastest Reliable Method?

Use a capability check, not a fixed list of usernames or display names. Capabilities describe what a user can do, such as edit posts or manage options. Roles can change, but the capability check still works. Add this logic through a child theme or custom plugin with PHP enabled.

The basic pattern is: if the current user cannot manage options, return false from the `show_admin_bar` filter. Administrators keep the bar, while other logged-in users do not see it. Test in a private browser window with a subscriber or customer account. Confirm the bar is gone on pages and posts, then log in as an administrator and confirm it remains.

Where Do You Place the Code?

Place the snippet in a child theme `functions.php` file or a small custom functionality plugin. A child theme preserves the change when the parent theme updates. A custom plugin preserves it when the theme changes. Avoid editing the parent theme directly.

Parent theme files are replaced during updates. Keep a note of where you added the code for future maintenance. If your site uses a code-snippets plugin, that is also a practical home. Turn the snippet on only for the front end if that option exists. Keep only one copy active to avoid conflicts.

Can Users Still Turn Off the Bar Themselves?

Yes, WordPress includes a per-user profile setting for the toolbar. Each user can open Users, then Profile, and uncheck the option for showing the toolbar when viewing the site. That choice affects only that account. This setting is useful for individual preference.

It is not reliable for site-wide control. A new user still sees the bar until they change the setting. Site owners often combine both approaches. Use code for the default rule for non-admin users. Leave the profile checkbox available for edge cases, such as an editor who prefers a cleaner view.

What Should You Check Before Publishing?

Check user roles beyond subscriber accounts. Membership, shop customer, student, forum participant, and custom client roles may all see the front end. Confirm the capability you selected matches the people you want to affect. Watch for caching and page-optimization plugins. Cached pages can show the wrong bar state to the wrong visitor.

Exclude logged-in pages from cache or test with caching active before launch.INTRODUCTION: Hide the WordPress admin bar for non-admin users with a small code snippet that checks capability and turns off the bar. Add a filter on `show_admin_bar` that returns false for anyone who cannot manage site settings. The admin bar is the dark toolbar at the top of the screen for logged-in users. It shows shortcuts to the dashboard, profile, and site actions. Hiding it cleans up the front end for subscribers, clients, and members.

  • Decide who keeps the bar, usually administrators only.
  • Add the capability-based filter in one location.
  • Test with a non-admin test account on desktop and mobile.
  • Check key templates: homepage, posts, checkout, course, and member pages.
  • Confirm admin users still reach the dashboard and editing shortcuts.

What Is the Fastest Reliable Method?

Use a capability check, not a fixed list of usernames or display names. Capabilities describe what a user can do, such as edit posts or manage options. Roles can change, but the capability check still works. Add this logic through a child theme or custom plugin with PHP enabled.

The basic pattern is: if the current user cannot manage options, return false from the `show_admin_bar` filter. Administrators keep the bar, while other logged-in users do not see it. Test in a private browser window with a subscriber or customer account. Confirm the bar is gone on pages and posts, then log in as an administrator and confirm it remains.

Where Do You Place the Code?

Place the snippet in a child theme `functions.php` file or a small custom functionality plugin. A child theme preserves the change when the parent theme updates. A custom plugin preserves it when the theme changes. Avoid editing the parent theme directly.

Parent theme files are replaced during updates. Keep a note of where you added the code for future maintenance. If your site uses a code-snippets plugin, that is also a practical home. Turn the snippet on only for the front end if that option exists. Keep only one copy active to avoid conflicts.

Can Users Still Turn Off the Bar Themselves?

Yes, WordPress includes a per-user profile setting for the toolbar. Each user can open Users, then Profile, and uncheck the option for showing the toolbar when viewing the site. That choice affects only that account. This setting is useful for individual preference.

It is not reliable for site-wide control. A new user still sees the bar until they change the setting. Site owners often combine both approaches. Use code for the default rule for non-admin users. Leave the profile checkbox available for edge cases, such as an editor who prefers a cleaner view.

What Should You Check Before Publishing?

Check user roles beyond subscriber accounts. Membership, shop customer, student, forum participant, and custom client roles may all see the front end. Confirm the capability you selected matches the people you want to affect.

Watch for caching and page-optimization plugins. Cached pages can show the wrong bar state to the wrong visitor. Exclude logged-in pages from cache or test with caching active before launch.

  • Decide who keeps the bar, usually administrators only.
  • Add the capability-based filter in one location.
  • Test with a non-admin test account on desktop and mobile.
  • Check key templates: homepage, posts, checkout, course, and member pages.
  • Confirm admin users still reach the dashboard and editing shortcuts.

You Might Also Like