Use WordPress’s show_admin_bar filter with a capability check to hide the front-end Toolbar from users who do not have the permission you choose. For example, the code below keeps it for users with manage_options and hides it for everyone else.
Hide the front-end Toolbar based on a capability
Add this snippet to your child theme’s functions.php file or, preferably for a rule that should survive theme changes, a site-specific plugin:
add_filter( 'show_admin_bar', function ( $show ) {
if ( ! current_user_can( 'manage_options' ) ) {
return false;
}
return $show;
} );
The show_admin_bar filter controls whether the Toolbar appears on the public-facing side of the site. The snippet returns false for users without the selected capability; for users who have it, it preserves WordPress’s existing decision, including their normal display preference. This filter does not disable the Toolbar in the WordPress dashboard.
Choose the capability that matches your policy
manage_options is a common choice for retaining the bar for administrators on a standard single-site installation. It is a capability check, not a universal test for an “administrator” role: custom roles and multisite setups can assign capabilities differently. Replace it with the capability that represents the permission you actually want to grant access to the Toolbar.
#1 Best Overall
Use current_user_can() for permission checks. is_admin() tells you whether the current request is for the administrative interface; it does not tell you whether the current user is an administrator.
Choose between a conditional rule and hiding it for everyone
| Approach | Use it when | Behavior |
|---|---|---|
Conditional show_admin_bar filter |
You want to keep the Toolbar for users with a particular capability and hide it from others. | The filter runs the capability rule on the front end. For users who pass the check, returning $show preserves WordPress’s prior result. |
show_admin_bar( false ) |
You want to set the Toolbar status to off for all users in the applicable context. | The documented function sets the status directly and may be called when a plugin loads or from a theme’s functions.php. |
For a rule specifically about non-administrators, the filter is the clearer fit because it can evaluate each user’s capabilities. The function is useful when the desired setting is unconditional.
Understand how the user’s Toolbar preference interacts with the rule
WordPress stores the front-end preference in the user-specific show_admin_bar_front setting. When that setting is unset, the default is to show the Toolbar. A user can change the preference in their profile, but the filter above overrides the normal result for users who lack the chosen capability.
WordPress documentation calls the interface the “Toolbar”; “Admin Bar” is the older term. The Toolbar terminology replaced Admin Bar in WordPress 3.3, while the function and filter date back to WordPress 3.1.0.
Free tools Windows power users keep installed
One-click scans. No signup required.
Do not remove the Toolbar by unhooking its private initializer
Avoid trying to remove the bar by unhooking _wp_admin_bar_init(). WordPress marks that function as private and warns: “UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.” Use show_admin_bar( false ) or the show_admin_bar filter instead.
Quick Recap
Best Value
Rank #4
- New
- Mint Condition
- Dispatch same day for order received before 12 noon
- Guaranteed packaging
- No quibbles returns
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

