Wondering how to hide the WordPress admin bar?
The admin bar (also called the toolbar) appears on the top of a page of a WordPress website. You have to be logged in to see it. It offers quick access to pages like Dashboard, Themes, Widgets, Menus, Customize, New Page, Edit Post, etc.
Although, by default, all WordPress users can view the admin bar, rarely do subscribers need it to access the backend. And for developers, it can really throw off the design of the front page. In such cases, hiding the admin bar is necessary. So, in this article we will show you how to disable the WordPress admin bar for:
- All users
- All users excluding the admin
- Specific users
- Specific user roles
Let’s dive right in.
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 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:
Using a plugin
Install and activate the “Hide Admin Bar on User Roles” plugin. Then go to Settings → Hide Admin Bar Settings. Select Hide Admin Bar for All Users and hit Save.
Side Note: If you can’t get the “Hide Admin Bar on User Roles” plugin to work on your WordPress website, try Custom Dashboard & Login Page or Hide Admin Bar. Both plugins are super easy to use.
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 → Theme 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
This article was written by Sufia Banu and originally published on ThemeIsle Blog.