0% found this document useful (0 votes)
48 views22 pages

How To Hide WordPress Admin Bar - Ultimate Guide For 2024

Uploaded by

Olusola Top
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views22 pages

How To Hide WordPress Admin Bar - Ultimate Guide For 2024

Uploaded by

Olusola Top
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

How to Hide WordPress Admin


Bar: Ultimate Guide
SUFIA BANU • Updated on: JANUARY 10, 2024 • 3

Want to hide the WordPress admin bar? This


toolbar, visible to logged-in users, offers quick
access to site features.

However, subscribers seldom need it, and for


developers, it can disrupt design. So, in this article
we will show you how to disable the WordPress
admin bar.

Key Takeaways

You can hide the admin bar for everyone or


just specific roles easily using the “Hide
Admin Bar on User Roles” plugin.
Alternatively, you can use either of two
code solutions. The easier one is to add this
CSS to your theme’s stylesheet:
#wpadminbar { display:none
https://themeisle.com/blog/hide-wordpress-admin-bar/ 1/22
4/13/24, 3:14 PM
#wpadminbarHow{to Hide
display:none
WordPress Admin Bar: Ultimate Guide for 2024

!important;}
Or, you can add the following line of code
to your theme’s functions.php file:
add_filter( 'show_admin_bar',
'__return_false' );

📚 Table of contents:
How to hide WordPress admin bar
Hiding the admin bar for all users
Hiding the admin bar for a specific user
Hiding the admin bar for a user role
Hiding the admin bar for all users except
administrators
Final thoughts

Want to hide your #WordPress #admin bar? Follow


these steps to do it 🙈
CLICK TO TWEET

How to hide WordPress admin


bar
There are two ways to hide the WordPress admin
bar The easy way is to install a plugin and the
https://themeisle.com/blog/hide-wordpress-admin-bar/ 2/22
4/13/24, 3:14 PM
bar. The easy way is to install a plugin and the
How to Hide WordPress Admin Bar: Ultimate Guide for 2024

hard way is to insert a code snippet manually. We


will show you both methods.

But before we proceed, we strongly recommend


that you take a backup of your entire website. In
this section, you will need to go to the backend of
your website and modify files which is risky
business. Even installing a new plugin is not
without risk as new installations are known to
crash websites. So, take a backup of your website
right away. If things ever go south, you can quickly
restore your website back to normal. That said,
hiding your WordPress admin bar isn’t a
particularly dangerous operation, so this is more
about being prepared for the future.

Alternatively, you can also carry out the operation


on a staging site without risking the live website.

Now, let’s begin:

1. Hiding the admin bar for all users


The admin bar can be an annoying presence. So,
if you want to disable it for all your users, then
here’s how to do it:
https://themeisle.com/blog/hide-wordpress-admin-bar/ 3/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

a) Using a plugin
Install and activate the “Admin and Site
Enhancements” plugin. Then go to Tools →
Enhancements. Select Admin Interface and
enable Hide Admin Bar. Expand the section and
check all the user roles to hide the admin bar for
all users. Click Save Changes.

Hide
admin
bar
for all
users
with a
plugin

Side Note: If you can’t get the “Admin and Site


Enhancements” plugin to work on your WordPress
website, try Custom Dashboard & Login Page or
Hide Admin Bar Based on User Roles. Both plugins
are super easy to use.

b) Using code
https://themeisle.com/blog/hide-wordpress-admin-bar/ 4/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

Installing and managing new plugins can be a


headache. So, if you are not a fan of adding new
plugins to your WordPress website, we
recommend going the manual way, i.e. adding a
code snippet to disable the WordPress admin bar.
Below are the steps you need to take:

Go to Appearance → Editor → function.php.


Scroll down to the end of the page and insert the
following code snippet.

/* Disable WordPress Admin Bar for


all users */
add_filter( 'show_admin_bar',
'__return_false' );

Here’s what it looks like on our website:

Manually
hiding

the
admin
bar for
all users

Y l di bl h
https://themeisle.com/blog/hide-wordpress-admin-bar/ d i b b i CSS 5/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

You can also disable the admin bar by using CSS.


Just go to Appearance → Customize → Additional
CSS and add the following CSS code:

#wpadminbar { display:none
!important;}

Inserting
CSS in
WordPress
theme

That’s it. You have now hidden the WordPress


toolbar for all users!

2. Hiding the admin bar for a specific


user

This is easy. You can hide the admin bar for


specific users from the dashboard.

Go to Users → All Users. Select the user you want


to hide the admin bar for. Uncheck the Show
https://themeisle.com/blog/hide-wordpress-admin-bar/ 6/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

Toolbar when viewing site option and save


changes.

Hiding the
toolbar
from the
WordPress
dashboard

The manual method works for a handful of users


but for a large number of users, you might want to
disable it based on WordPress user roles.

3. Hiding the admin bar for a user role


Certain user roles (like subscribers, customers, etc.)
don’t have to have access to the WordPress
dashboard. To discourage them from accessing
the dashboard, you can hide the WordPress admin

bar based on user roles. Here’s how to hide


WordPress admin bar for a certain user role:

a) Using a plugin
https://themeisle.com/blog/hide-wordpress-admin-bar/ 7/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

Install and activate the “Admin and Site


Enhancements” plugin.

Go to Tools → Enhancements, select Admin


Interface, and enable Hide Admin Bar. Expand
the options and check the user roles you want to
prevent from accessing the WordPress dashboard
and save your settings.

Hiding
the
admin
bar for
specific
user
roles
with a
plugin

b) Using code
If using a plugin is not your cup of tea, then insert
the following code in your theme’s function.php
file:

function tf check user role( $roles )


https://themeisle.com/blog/hide-wordpress-admin-bar/ 8/22
4/13/24, 3:14 PM
function tf_check_user_role( $roles )
How to Hide WordPress Admin Bar: Ultimate Guide for 2024

{
/*@ Check user logged-in */
if ( is_user_logged_in() ) :
/*@ Get current logged-in
user data */
$user =
wp_get_current_user();
/*@ Fetch only roles */
$currentUserRoles = $user-
>roles;
/*@ Intersect both array to
check any matching value */
$isMatching =
array_intersect( $currentUserRoles,
$roles);
$response = false;
/*@ If any role matched then
return true */
if ( !empty($isMatching) ) :
$response = true;
endif;

return $response;
endif;
}
$roles = [ 'customer', 'subscriber'
];
https://themeisle.com/blog/hide-wordpress-admin-bar/ 9/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

if ( tf_check_user_role($roles) ) :
add_filter('show_admin_bar',
'__return_false');
endif;

Don’t forget to replace ‘customer’ and ‘subscriber’


with user roles of your choice.

Manually
hiding
the
admin
bar for
specific
user
roles

4. Hiding the admin bar for all users


except administrators
Arguably, administrators are the most active users
on a WordPress website. Having quick access to
important pages can be a blessing. In that case,
you might want to enable the toolbar for
administrators only.
https://themeisle.com/blog/hide-wordpress-admin-bar/ 10/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

Here’s how to hide WordPress admin bar for all


users except the administrators:

a) Using a plugin
This is super easy. With the same Admin and Site
Enhancements plugin. Again, go to Enhancements
under the Tools menu. From the Admin Interface
tab, enable Hide Admin Bar. Check all the user
roles except for administrators.

Hiding the
admin bar for
all users
except
administrators
with a plugin

b) Using code
You can hide the admin bar for all users except the
administrator without using a plugin. All you need
to do is add the following code snippet to your
theme’s functions.php file:

https://themeisle.com/blog/hide-wordpress-admin-bar/ 11/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

add_action('after_setup_theme',
'remove_admin_bar');
function remove_admin_bar() {
if
(!current_user_can('administrator')
&& !is_admin()) {
show_admin_bar(false);
}
}

Manually
hiding admin
bar from all
users except
administrators
Every time someone logs into your WordPress site,
the code checks the user role. If it’s not an
administrator, the user is prevented from seeing
the admin bar.

That’s it, folks! Now you know how to hide


WordPress admin bar.

PRO TIP: If you are just looking to declutter the


admin bar, then you can customize it. Just remove
https://themeisle.com/blog/hide-wordpress-admin-bar/ 12/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

the parts that you don’t require and add parts that
you do. We have a separate guide on that. Take a
look – how to customize the WordPress toolbar.

Final thoughts on how to hide


🏁
WordPress admin bar in 2024

The WordPress admin bar is a useful tool but


sometimes it hinders more than it helps. Hence,
removing it can be a good idea. You can always
enable it back by simply removing the plugin or
code snippet that helped you hide it in the first
place.

Want to hide your #WordPress #admin bar? Follow


these steps to do it 🙈
CLICK TO TWEET

If you do need to enable it, just remember to take


a backup of your site before introducing any
modifications.
https://themeisle.com/blog/hide-wordpress-admin-bar/ 13/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

Did you successfully hide the WordPress admin


bar? Are you facing any challenges? Let us know
in the comment section below.

FREE GUIDE

4 Essential Steps to
Speed Up
Your WordPress
Website
Follow the simple
steps in our 4-part
mini series
and reduce your

loading times by 50-


80%. 🚀
FREE ACCESS
https://themeisle.com/blog/hide-wordpress-admin-bar/ 14/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

Was this article helpful? Yes No

By SUFIA BANU
Themeisle Contributor
43 Posts

Sufia is a writer with 10 years of solid experience in writing,


content marketing, and on-page SEO. She has a master's
https://themeisle.com/blog/hide-wordpress-admin-bar/ 15/22
4/13/24, 3:14 PM g How to HidepWordPress
g Admin Bar: Ultimate Guide for 2024
degree in Mass Communication & Journalism and
specializes in writing about WordPress, plugins, themes, and
WooCommerce. Her work has been published across
numerous WordPress blogs and they have helped many
WordPress businesses draw better traffic and skyrocket their
sales revenue.

UPDATED ON: POSTED IN: SHARE NOW!


January 10, WordPress
Share
2024
Tweet

You can check also:


We Compared 4 WordPress Activity Logs Plugins:
Our Results
Wordfence Security vs iThemes Security: Which
Should You Use?

How to Import Amazon Products to


WooCommerce in 4 Steps
4 of the Best WordPress Spinning Wheel Plugin
Options (Tested)
Jetpack vs Wordfence: WordPress Security Plugin
C i
https://themeisle.com/blog/hide-wordpress-admin-bar/ 16/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024
Comparison
Astra Theme Review: It’s Hugely Popular, but Is It
Actually Worth It?

Comments

Join the discussion

3 COMMENTS Newest 

Haibo Zhou  April 2, 2024 4:11 pm


Hi,
I’ve tried using your solution b of 4 to add
code snippet into functions.php. But it doesn’t
work. Could you please help?

By the way, I see in your screenshot that you


have under Appearance two additional
options “Theme Editor” and “Astra Options”
which I don’t have. Which version of Astra do
you use? I also use Astra Pro theme. Why?
BR
https://themeisle.com/blog/hide-wordpress-admin-bar/ 17/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

0 0 Reply

xanaddams  March 16, 2024 5:02 am


what if I just want to hide it while in mobile
view?
0 0 Reply

Member

Ivica  March 18, 2024 10:07 am


 Reply to xanaddams
Maybe you can try this plugin for
doing that:
https://wordpress.org/plugins/power
up/.
Or try this CSS code:
Access your theme’s functions.php file
(Appearance > Theme Editor >
functions.php).
Add the following code snippet:
@media screen and (max-width:
767px) {
#wpadminbar {
display: none !important;
}
}

0 0 Reply

Or start the conversation in our Facebook group


https://themeisle.com/blog/hide-wordpress-admin-bar/ 18/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

for WordPress professionals. Find answers,


share tips, and get help from other WordPress
experts. Join now (it’s free)!

Show your love!


Share Tweet Subscribe

Popular Posts

Best Free Elementor Themes

Use ChatGPT to Build a Website

How to Download WordPress

Best Shopify Themes

How to Renew Your SSL Certificate in 4 Simple Steps


(2024 Tutorial)

View the Mobile Version of a Website


https://themeisle.com/blog/hide-wordpress-admin-bar/ 19/22
View the Mobile Version of a Website
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

Shopify Tutorial: A Detailed Step-by-Step Guide for


Beginners

How to Host a Website for Beginners

What Is Root Directory

Dynamic Content in Gutenberg

https://themeisle.com/blog/hide-wordpress-admin-bar/ 20/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

We’re a crew of WordPress professionals sharing


our map to WordPress success with brilliant
tutorials and tips.

#Trending
The History of Blogging
How to Create a Website
Canva Alternatives
Best Website Builder
Recommended Hosting
ChatGPT Alternatives

Our Network
CodeinWP
Optimole
Domain Wheel
ReviveSocial
WPShout
https://themeisle.com/blog/hide-wordpress-admin-bar/ 21/22
4/13/24, 3:14 PM How to Hide WordPress Admin Bar: Ultimate Guide for 2024

Company
About us
Newsletter
Contact us
Careers

Copyright © 2024 Themeisle |


Terms | Privacy Policy
Powered by VertiStudio

https://themeisle.com/blog/hide-wordpress-admin-bar/ 22/22

You might also like