Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsTo hide the WordPress Toolbar (often called the admin bar) on the public-facing site, use WordPress’s supported visibility API rather than CSS or by removing an internal hook. Add add_filter( 'show_admin_bar', '__return_false' ); to a site-specific plugin or your active theme’s functions.php. If administrators should keep the bar, call show_admin_bar( false ) only when the current user lacks the capability you choose.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
This changes front-end visibility. It does not remove dashboard navigation, change a user’s role, or revoke permissions. Each logged-in user’s own “Show Toolbar when viewing site” profile setting can also affect the result.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
WordPress Multisite Administration | $34.38 | Buy on Amazon |
| 2 |
|
Mon Site WordPress – Volume 2 – Administration & Utilisation (French Edition) | $9.90 | Buy on Amazon |
| 3 |
|
WordPress 24-Hour Trainer | $3.95 | Buy on Amazon |
| 4 |
|
Teacher Record Book | $4.89 | Buy on Amazon |
As an Amazon Associate I earn from qualifying purchases.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →What the WordPress admin bar is—and what hiding it changes
WordPress calls the bar the Toolbar. It is the dark strip that can appear above the site for logged-in users, with links to WordPress information, creating posts and pages, adding users, reviewing comments, and update notices. The show_admin_bar() function has been part of WordPress since version 3.1.0 and controls whether the Toolbar is displayed.
There are two separate surfaces to keep straight:
- Front end: the public site visitors see. The
show_admin_barfilter andshow_admin_bar( false )control the Toolbar here. - Dashboard: the administration area under
/wp-admin/. The documented filter does not turn off the dashboard Toolbar, and hiding the front-end bar does not remove dashboard menus or capabilities.
Therefore, this is a presentation change, not an access-control measure. A subscriber who can no longer see the front-end bar still has exactly the same role and permissions. Use WordPress roles and capabilities when the requirement is to prevent an action; use the Toolbar API when the requirement is to remove the strip from the site.
#1 Best Overall
Choose the right method
The best implementation depends on who should lose the bar and where you want the rule maintained.
| Method | Front end | Dashboard | Targeting | Maintenance and risk | What it changes |
|---|---|---|---|---|---|
add_filter( 'show_admin_bar', '__return_false' ) |
Hides it for logged-in users covered by the filter | Does not disable the dashboard Toolbar | All users unless the callback adds a condition | Simple code; a broadly scoped filter in a shared plugin can conflict with other code | Visibility only |
show_admin_bar( false ) in a conditional action |
Hides it when the condition runs | Does not remove dashboard navigation | Roles, capabilities, or other conditions | Explicit and easy to audit; must run at an appropriate setup hook | Visibility only |
| User profile preference | Changes the individual user’s front-end display | Does not remove dashboard access | One user at a time | No code; users can change the setting again | That user’s display preference |
| Role-based settings plugin | Can hide it according to the plugin’s rules | Depends on the plugin and its documented scope | Roles, capabilities, devices, pages, or schedules may be available | Settings-based; check current maintenance, compatibility, and licensing before installing | Usually visibility, not permissions |
Hide the bar for everyone on the front end
For a site where no logged-in user should see the Toolbar while browsing public pages, use the documented filter:
<?php
add_filter( 'show_admin_bar', '__return_false' );
Place this in a small site-specific plugin or in the active theme’s functions.php. A site-specific plugin keeps the rule independent of a theme switch; a theme file is convenient when the behavior is deliberately part of that theme. Add the code once, not in several places.
Step-by-step
- Back up the site and make sure you can restore the file or deactivate the custom plugin if a PHP error occurs.
- Open the active theme’s
functions.phpin a child theme, or open the site-specific plugin where you keep custom behavior. - Paste the filter after the opening PHP tag. Do not add a second opening
<?phpif the file already has one. - Save the file, clear any page, browser, or optimization cache, and sign in to a test account.
- Visit a front-end page. The Toolbar should no longer be rendered for that account. Visit
/wp-admin/separately to confirm that dashboard behavior remains governed by WordPress’s administration UI and the user’s permissions.
WordPress Developer Resources states that returning false from this hook is the recommended way to hide the admin bar. This approach is preferable to styling the bar away because it uses the supported visibility decision rather than leaving the Toolbar generated in the page.
Keep the bar for administrators and hide it for other users
“Administrator” is often used informally to mean anyone who should retain the bar. In code, a capability is more precise than a role-name test. The following example keeps the Toolbar for users with manage_options and hides it for users without that capability:
<?php
add_action( 'after_setup_theme', function () {
if ( ! current_user_can( 'manage_options' ) ) {
show_admin_bar( false );
}
} );
manage_options is commonly available to administrators, but capabilities can be assigned differently on a customized site. Decide which capability represents “may keep the Toolbar” for your installation, then use that capability consistently.
Why use after_setup_theme?
The action runs while the theme is setting itself up, at a point where WordPress can apply the front-end display decision. The official function reference also permits calling show_admin_bar() immediately from a plugin or theme. Using a named setup action makes the timing obvious and keeps the condition close to the site behavior it controls.
What happens for logged-out visitors?
The Toolbar is a logged-in-user feature. A visitor who is not authenticated normally has no user Toolbar to hide. The conditional code matters for signed-in accounts; it does not turn a public visitor into a different permission class.
Hide it for subscribers (and why capability checks are usually better)
If the requirement is specifically “subscribers should not see the bar,” WordPress.org support documents this role check:
<?php
function hide_admin_bar_for_subscribers() {
if ( current_user_can( 'subscriber' ) ) {
show_admin_bar( false );
}
}
add_action( 'after_setup_theme', 'hide_admin_bar_for_subscribers' );
This can be suitable for a site whose policy is tied exactly to the subscriber role. For a broader policy such as “hide it from everyone who is not an administrator,” the capability example is more flexible. A custom role, a renamed role, or a user with several assigned roles may not fit a single role-name test, while a capability expresses the permission boundary directly.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Do not confuse a role check with security. Neither snippet changes what the subscriber can do. It only sets the Toolbar’s display status on the front end.
Use each user’s own profile preference
WordPress also provides a no-code control for an individual account. A user can open the profile screen and change Show Toolbar when viewing site. The usual path is:
Rank #3
- Sign in to WordPress.
- Open Users → Profile (or the profile link in the account menu).
- Find the Show Toolbar when viewing site option.
- Clear it to hide the front-end Toolbar for that account, then save the profile.
WordPress reads this preference when calculating front-end visibility. It is therefore possible for a user to have the correct code in place and still see a different result because that account’s profile setting is enabled or disabled. This preference is per user; it is not a replacement for a site-wide policy when every non-admin account must follow the same rule.
No-code configuration with a role-based plugin
Readers who do not want to maintain PHP can use a plugin that provides “Hide Admin Bar Based on User Roles” settings. Its WordPress.org listing advertises rules for subscribers, WooCommerce customers, all users, and custom visibility by role, capability, device, page, or time.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Before relying on a settings-based solution, check the listing’s current maintenance date, tested WordPress versions, support activity, and whether the features you need are free or paid. Plugin behavior can change, and a plugin may offer controls that extend beyond the core front-end Toolbar filter. After activation:
- Open the plugin’s settings page and identify whether its rule applies to the front end, the dashboard, or both.
- Create the narrowest rule that matches the requirement, such as hiding the Toolbar for subscribers while leaving administrators unaffected.
- Check whether the plugin’s rule overrides the individual profile preference or combines with it.
- Test one account from each relevant role in a private browser window and verify both a front-end page and the dashboard.
- Document the rule so another administrator can find and change it later.
A plugin can make administration easier, but it still should not be treated as an authorization system. Keep permission changes in WordPress roles and capabilities.
Why CSS-only hiding is a poor substitute
A CSS rule such as hiding #wpadminbar may make the strip invisible, but it does not ask WordPress not to generate the Toolbar. It can leave spacing, scripts, or other theme interactions behind, and it does not alter dashboard access or permissions. CSS can be useful for a visual adjustment after the supported API has made the correct visibility decision; it is not the primary removal method.
Do not unhook _wp_admin_bar_init()
WordPress explicitly warns against removing the internal _wp_admin_bar_init() hook to get rid of the Toolbar. Unhooking internal initialization does not properly implement the feature’s supported visibility path and can produce incomplete or unpredictable behavior. Use show_admin_bar( false ) or return false from the show_admin_bar filter instead.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRank #4
- Keep track of everything from attendance to test scores
- Spiral bound
- Measures 8-1/2" x 11"
Troubleshoot a bar that will not disappear
The bar is still visible on the front end
- Check the account: confirm that you are signed in as the role or capability your condition targets. A user with
manage_optionswill intentionally keep the bar in the administrator-preserving example. - Check the profile setting: inspect Users → Profile → Show Toolbar when viewing site. WordPress incorporates the user’s preference into front-end visibility.
- Check code location: make sure the snippet is in the active theme or an activated site-specific plugin, and that the file contains no PHP syntax error.
- Check competing code: another plugin, a must-use plugin, or the theme may add a later filter or call
show_admin_bar( true ). Temporarily test with nonessential plugins disabled on a staging copy to identify the conflict. - Clear caches: clear the browser cache and any page, object, CDN, or optimization cache after changing PHP.
The bar is missing even though it should be shown
WordPress’s Toolbar documentation notes that a theme may fail to call wp_footer(), or a plugin may have disabled the Toolbar. A missing wp_footer() call is a theme defect: WordPress and many plugins expect it immediately before the closing </body> tag. Confirm that the active theme’s footer template calls it, and inspect plugin filters if the call is present.
A blank strip remains at the top
If the Toolbar is hidden but an empty gap remains, inspect the theme’s top margin and body padding, cached CSS, and optimization layers. Some themes add spacing when they detect a logged-in user or the Toolbar. Remove only the spacing rule that your theme introduced; do not use that cleanup as a reason to bypass the supported API.
The dashboard still shows a Toolbar
This is expected for the front-end filter. The documented hook controls the Toolbar on the front side of the website; it does not turn off the WordPress dashboard Toolbar. If the objective is to change dashboard menus or administration access, use appropriate role and capability controls rather than a front-end visibility snippet.
Safe testing checklist
- Test while logged out to confirm public pages are unaffected.
- Test an administrator or another account with the retained capability.
- Test a subscriber or ordinary member account that should lose the bar.
- Check a page, a post, and a template that uses a different layout.
- Open the dashboard for each test account to verify that the change did not alter permissions.
- Check the browser’s page source or inspector only to diagnose a remaining gap; do not assume that an invisible element means access has been removed.
- Record whether the rule lives in a theme, child theme, site-specific plugin, or settings plugin so it survives routine maintenance.
Common decisions
Hide it from everyone or only regular users?
Use the unconditional filter when no signed-in visitor needs front-end Toolbar links. Use a capability condition when administrators or another privileged group should retain them.
Should a custom role be included?
Prefer a capability that represents the policy. A role-name test is appropriate only when the policy is explicitly tied to that role and the site will not rename or combine roles.
Will this remove the WordPress dashboard?
No. It changes a front-end Toolbar display decision. Dashboard URLs, navigation, and permissions remain governed by authentication, roles, and capabilities.
Can users turn the bar back on?
If the site relies only on each user’s profile preference, yes. A site-wide filter or conditional call applies the policy in code and can override what an individual expects to see, depending on the final filter and plugin configuration.
Recommended implementation
For most sites that want administrators to retain the convenience links while regular users browse a clean front end, put the capability-based show_admin_bar( false ) condition in a site-specific plugin or child theme. Use the unconditional filter when the bar is unwanted for every logged-in front-end user. Keep the dashboard and permission model separate, test with accounts from every affected group, and investigate wp_footer(), profile preferences, competing filters, and cached CSS when the result differs from the rule.
Recommended Free Tools
Quick Recap
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.




