How to hide the Admin Bar in WordPress

The WordPress content management system is designed to make it easier to build, control, and manage websites. Therefore, it provides many options that allow users to quickly access its features and tools. However, you may sometimes need to turn off some of the facilitation options that WordPress offers.

In this article, we will explain different ways to hide the Admin Bar, or what is also called the Toolbar in WordPress, after we take a quick look at this bar and some of the options it contains.

What is the admin bar?

The admin bar is the toolbar that WordPress displays by default at the top of the frontend and backend to users who are logged in to the website admin area, and it provides easy and quick access to features and options that the user is likely to need access to, such as the option to edit the article, etc.

The admin bar also includes shortcuts that help facilitate navigation between the different sections of the WordPress site, such as moving from the front end to the back end or vice versa. The shortcuts contained in the bar vary depending on the user’s rank. The shortcuts that appear to the administrator differ from the shortcuts that appear to the writer, and they may also differ. The shortcuts shown in the ribbon also depend on the open web page.

Although the toolbar on WordPress sites makes it much easier to access some options and features, you may need to hide it and prevent it from being visible at times for various reasons, such as when it is distracting to users, or when you want to evaluate the design and appearance of the site and do not want the toolbar to affect Your rating.

 


How to hide the admin bar in WordPress

In fact, there are many ways that enable you to disable the appearance of the toolbar on a WordPress site, and each method provides advantages and options that differ from other methods. Some of them you can implement to hide the appearance of the toolbar for all users who have a certain rank, and some of them allow you to hide the toolbar for a specific user, and some of them enable you to Hide the bar for all users.

Here we will explain several ways to perform the task, and within the context of the explanation we will explain the advantages of each method so that you can choose the method that best suits what you want.

Hide the admin bar for a specific user

The toolbar can easily be hidden for a specific user without the need to install any additional components on the website or insert any programming codes into it, as WordPress provides this by default within the pages for editing users’ personal files, and since the site administrator has the powers to edit the personal files of all users, He can disable the ribbon from appearing for any user he wants.

To hide the admin bar for a specific user in WordPress, go to the (Members) page in the WordPress backend by placing the mouse cursor on the (Members) option located in the side menu, then clicking on (All Members) from the drop-down list that appears.

Go to the Members page in WordPress

On the Members page, place the mouse cursor on the item for the user for whom you want to disable the toolbar, then click on the word (Edit) that appears below it to go to the edit profile page for that user.

Click Edit to go to the user profile editing page

Search for the option (Show the toolbar in the site interface) on the profile editing page, then deactivate it by removing the checkmark from the box next to it.

Deactivate the option to show the toolbar in the site interface to hide the admin bar

After that, scroll to the bottom of the page, then click on the ( Update Member ) button to save the modifications you have made to the member account and apply them.

Clicking on the Update Member button to cancel the admin bar from appearing to the user

Now, when the user visits the front end of the website, he will not see the toolbar even if he has logged in to the site, but this will not hide the toolbar in the backend of WordPress (the site administration area), as the toolbar will appear as usual in that interface.

It is worth noting that this method does not provide the ability to hide the admin bar for a group of users at the same time, as you will need to re-perform all the steps for each user who has the bar hidden, and therefore it will not be effective if you have a large number of users for whom you want to hide the bar. Fortunately, there are other, more effective methods in this case.

Hide the toolbar from users based on their rank using an extension

This method is one of the best ways to hide the toolbar and prevent it from appearing to users, because it can be applied very easily and quickly, and it allows you to determine who will show you the toolbar and who will not, depending on the user’s rank. You can, for example, prevent the admin bar from appearing for all users except Officials.

To hide the admin bar using this method, you must first install the Hide Admin Bar Based on User Roles plugin on your WordPress. If you do not know how to do that, you can review our article that explains how to install plugins on WordPress ( How to install and activate a WordPress plugin on your site in the correct manner ) and apply one of the methods described therein.

After installing and activating the add-on and activating it on your site, go to its settings page by clicking on (Hide Admin Bar Settings) that appears when you place the mouse cursor on the (Settings) option located in the side menu of the WordPress control panel.

Go to the Hide Admin Bar by Rank add-on settings page

On the add-on settings page that opens after clicking (Hide Admin Bar Settings), you will find a set of options that enable you to hide the admin bar according to a specific criterion, and you can activate each of these options by placing a check mark in the box next to it.

When you put a check mark next to (Hide Admin Bar for All Users), the admin bar will not appear for any of the users, including users who have the Administrator rank. When you put a check mark next to (Hide Admin Bar for All Guests Users), the admin bar will not appear. Administrator for guest users.

The admin bar can be hidden from users by activating the options by placing a check mark next to them
The admin bar can be hidden from users by activating the options by placing a check mark next to them

As for the options in the (Hide admin bar for selected user roles) section, they allow you to hide the admin bar for users according to their rank in WordPress. When you put a check mark next to (Administrator), the bar will not appear for administrators, and when you put a check mark next to (Editor), it will not appear. Tape for editors, and so on.

An image showing which user level each of the existing options hides the admin bar

The Hide Admin Bar Based on User Roles addition also provides the ability to hide the admin bar for users if they have a specific ability that you specify. You can enter the ability or capabilities that when the user has one of them, the bar will not appear in the field next to the phrase (Hide admin). bar for selected user capabilities).

Hide the admin bar from users with specific capabilities you specify

It is worth noting that after making the modifications you want to the settings to show or hide the admin bar on the Hide Admin Bar Settings page, you must click on the (Save Changes) button located at the bottom to have them applied. You can also return the extension’s default settings by clicking and visiting the link below this button.

How to apply modifications made to the extension settings and how to return the default settings

We would also like to point out that there are other plugins that support the ability to hide the admin bar, but this plugin is one of the best free plugins dedicated to performing this function. It also hides the bar in the front end of the WordPress site only, as the bar will appear in the user’s backend regardless of its settings. .

Hide the admin bar by entering a code

If you want to hide the admin bar for all users of all levels, but you do not want to install plugins on your WordPress system, you can do this easily by adding code to the functions.php file of the WordPress theme you are using.

Note: If you manage to hide the admin bar in this way, it is preferable to first take a backup copy of your site in case of any problems that may occur, and you can do this by following one of the methods that we explained in our article ( Explanation of making a backup copy of your site to secure it from any damage ).

To hide the toolbar for all users by entering code in the functions.php file, go to the Template Editor tool page by placing the mouse cursor on the word (Appearance) in the side menu of WordPress, then clicking on the (Theme Editor) option from the drop-down menu that appears. .

Go to the WordPress theme editor tool page

On the side of the Template Editor tool page, you will notice a section where you can navigate between different template files. You must go to the template properties file (functions.php) by clicking on it, as this will display the content of the file in the custom field located under (content of the selected file), and you will be able to modify the file, delete codes from it, or add codes to it through this field.

How to open the functions.php file in the WordPress theme editor

Navigate to the bottom of the field content that displays the contents of the functions.php file, then copy and paste the following code there.

/* Disable WordPress Admin Bar for all users */
add_filter( ‘show_admin_bar’, ‘__return_false’ );

After pasting the previous code into the field, click on the (Update File) button to save the modifications you made to its content.

Enter the code to hide the admin bar for all users and click the Update File button to save the changes

Within seconds, the file will be updated and the modifications you made in it will be applied to the site. Therefore, when you go to one of the front-end pages of your site, you will notice that there is no admin bar at the top of it, while the bar will still appear at the top of the screen when you visit one of the WordPress back-end pages.

Thus, we have finished explaining 3 ways to hide the admin bar or toolbar in WordPress. You can use the method that you think is most suitable for you, but we do not advise you to use the method that requires entering code into the template files if you do not have experience in dealing with code in WordPress. , especially without making a backup copy of the site, so we generally recommend using the second method, which includes installing an add-on and using it to hide the admin bar.

Avatar photo
I am a young man who has been working in WordPress and e-marketing for 10 years. I would like to share my experience with you so that we can become professional in WordPress I will be happy to share the experience with you.