Hide Admin Bar
Product: Admin Framework Pro
The Hide Admin Bar module lets you control when and for whom the WordPress admin bar is displayed. You can hide it for specific user roles or on certain pages, creating a cleaner front-end experience while keeping administrators in full control.
How to use
To enable the Hide Admin Bar Module:
- Click on the “Disable & Organise” category
- Search or scroll to locate the Hide Admin Bar Module
- Click on the switch to enable
What’s next?
This module allows you to hide the WordPress admin bar for specific user roles. After enabling:
1. Configure User Roles
- Click on the “Settings” tab below the module name
- Under “User Roles”, select which user roles should have the admin bar hidden
- Click “Save Changes” to apply your settings
2. What’s Affected
- The admin bar will be hidden for selected user roles when viewing the front-end of the site
- The admin bar will still be visible in the WordPress admin area
- Administrators will always see the admin bar (cannot be hidden for security reasons)
3. Customization
The module provides several filters for customization:
Modify which user roles are available for selection:add_filter('WPMazic/hide-admin-bar/user_roles', function($roles) { // Add or remove roles unset($roles['editor']); // Don't allow hiding for editors return $roles; });Completely override the admin bar visibility:add_filter('WPMazic/hide-admin-bar/should_hide', function($should_hide, $user_roles) { // Custom logic to determine if admin bar should be hidden return $should_hide; // true or false }, 10, 2);
4. Show/Hide on Specific Pages
To show or hide the admin bar on specific pages:
Show admin bar on specific pages:add_filter('WPMazic/hide-admin-bar/should_hide', function($should_hide) { if (is_page('contact')) { return false; // Show admin bar on contact page } return $should_hide; }); Or hide on specific pages:add_filter('WPMazic/hide-admin-bar/should_hide', function($should_hide) { if (is_singular('product')) { return true; // Hide on single product pages } return $should_hide; });
5. Re-enable the Admin Bar
To show the admin bar again:
- Go back to the Hide Admin Bar Module Settings
- Deselect the user roles that should see the admin bar
- Click “Save Changes”
Important Notes:
- Administrators will always see the admin bar (cannot be hidden)
- Changes take effect immediately after saving settings
- Some plugins may add their own admin bar items that could still be visible
- The admin bar is always visible in the WordPress admin area
Troubleshooting:
If the admin bar is not hiding as expected:
- Clear your browser cache
- Make sure you’re logged in as a user with one of the selected roles
- Check for plugin conflicts by temporarily deactivating other plugins
- Ensure your theme isn’t forcing the admin bar to show
This module is ideal for:
- Client websites where you want to provide a cleaner front-end experience
- Membership sites with different user roles
- Improving the front-end design by removing the admin bar
- Reducing distractions for certain user roles