How to Hide or Disable WordPress Admin Bar Using a Plugin or Code

When accessing a WordPress website, logged in users should see a black bar at the top of the page. Known as the WordPress admin bar, it serves as a quick access shortcut containing various options.

Although the WordPress admin bar is a useful tool, many web developers hide it to preserve the site’s design. Some may also disable it to prevent other users from accessing the WordPress dashboard.

This article will explain different methods to hide your WordPress site admin bar for all and specific users.

Important! Before any modification, Back up your WordPress site. If you encounter an error, restore a previous version of the site using the backup file.

How to hide admin bar for all users

It is possible to disable the admin bar using a plugin or by editing the site code. Remember that this method will disable the WordPress admin bar for All users at once.

Use a plugin

There are various plugins for this purpose, such as Hide admin bar. They offer a visual interface, ideal if you are unfamiliar with the programming language.

They are also easy to configure and disable if needed. For this tutorial, we will be using Hide Admin Bar as it is the most popular option.

Once activated, this WordPress plugin will automatically disable the admin bar:

  1. Open your WordPress admin page. In the sidebar, navigate to → pluginsAdd new
  2. Enter the plugin name in the search bar and press Walk in.
  3. Click on Install. Once the installation is complete, select Enable.

Instead of disabling the top admin bar, you can hide it using a WordPress plugin like Automatically hide the admin bar.

The toolbar will only appear when you hover the cursor over the top area of ​​the website.

Redeem code

If you have too many plugins, remove the admin bar manually by editing the site code. You can do this in several ways – by editing your WordPress theme file or by adding custom css code.

Here are the steps to hide the toolbar by changing your website theme .php file:

  1. Login to your WordPress admin page.
  2. From WordPress menugo to → AppearanceTheme file editor.
  3. Find it Theme files on the right side of your screen and click functions.php.
  4. Scroll to the end of the page and paste the following code snippet:
add_filter('show_admin_bar', '__return_false');
  1. Click it Update file button to save changes.

Important! If the Theme file editor the menu is not available in the Appearance section, it may be under the Tools category.

You can also remove the admin bar by writing CSS:

  1. In the WordPress sidebar, select → AppearancePersonalize. If you can’t find this menu, open the customizer by visiting sitename.tld/wp-admin/customize.php on your web browser.
  2. In the left sidebar, select Additional CSS.
  3. Enter the following code:
 #wpadminbar {display:none !important;}
  1. Click it Publish button.

How to hide the admin bar for a specific user

If you don’t want to hide the admin toolbar from everyone, disable it for a specific user. This method helps prevent other users from accessing your site’s WordPress dashboard.

Hide the admin bar from a particular user by editing their profile through the WordPress admin dashboard:

  1. On the WordPress dashboard, navigate to the sidebar → UsersAll the users.
  2. Search for the desired user. Hover over it user profile and click Edit under their name.
  3. Under the Personal options section, find the Toolbar option and uncheck the Show toolbar when viewing the site box.
  4. Scroll down the page and click Update Profile to confirm.

The user will always see the toolbar in the WordPress admin area. However, they won’t see it when they visit the front-end of the website.

How to hide admin bar for specific user roles

It is also possible to manually hide the admin bar for multiple WordPress users. However, this is tedious and time-consuming, especially if there are a lot of them.

To easily disable the admin toolbar for multiple users, assign them the same role. Then use a plugin or code to hide the admin bar from that user role.

Use a plugin

Some WordPress plugins allow you to hide the toolbar for certain user roles. However, you must first assign the users to the same role:

  1. From the WordPress sidebar → UsersAll the users.
  2. Locate the user and select Edit.
  3. Under the Last name section, assign a Role in the drop-down menu.
  4. Click on Update User.

To change roles for multiple users at once, follow these steps:

  1. Click the box next to their profile picture.
  2. Choose a role from the Switch roles for… drop-down menu and click To change.

Now download and install a plugin to hide the admin toolbar. In this tutorial, we will use Hide admin bar based on roles.

It allows you to hide the admin toolbar for WordPress User Roles and Permissions. Here are the steps to hide the WordPress admin bar using this plugin:

  1. In the sidebar, navigate to SettingsHide admin bar settings.
  2. Check the boxes next to the user roles whose toolbar you want to hide.
  3. Optionally, complete the Abilities blacklist dialog box. Separate multiple abilities by pressing Walk in.
  4. Click on Save changes.

Redeem code

Disable the admin bar for specific roles by adding a code snippet to the functions.php file of your WordPress site. You will need to use a different code for different roles and purposes.

For example, to hide the admin bar for all users except those with administrative privileges:

  1. In WordPress sidebar → AppearanceTheme file editor.
  2. Go to the Theme files sidebar and click functions.php.
  3. Scroll to the bottom of the screen and paste the following:
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {

Every time a user visits your site, this code checks if they have an admin role. If they don’t, it will automatically hide the toolbar.

If you want to show the toolbar for admin and specific user roles, use the following instead:

function hide_wordpress_admin_bar($hide){
if (!current_user_can('administrator') || !current_user_can('subscriber')) {
return false;
return $hide;
add_filter( 'show_admin_bar','hide_wordpress_admin_bar');

The above command will hide the toolbar from all users except those with admin or subscriber role.

You can change or add other options by entering !current_user_can('role'), replacing “role” with the corresponding value.

Last Words

The WordPress admin bar is a quick access toolbar with various function shortcuts. Although this is a useful feature, some web developers prefer it to be hidden due to site visibility and security concerns.

Popular methods to hide the WordPress admin bar for all users or some users include:

  • Using the WordPress Admin Dashboard
  • With a plugin, such as Hide admin bar Where Disabling the admin bar
  • Add code to your site functions.php Where CSS case

We hope this article helped you find a suitable method. If you have any questions about hiding the WordPress admin bar, leave them in the comment section below.

Leave a Reply

Your email address will not be published. Required fields are marked *