In default wordpress website, when we are login in a tab and looking at the frontend in another tab of same browser then a admin bar or we can say that a toolbar show at the top of our web page. Generally it is vey useful for developers or admin users of the website.
But we want to get rid of this to make our website more user friendly. So there are so many ways to hide or remove this admin bar at frontend. Here we are discussing about few of them:
From admin settings :
By this method we can disable this tool bar for some of our specific users. To do this just follow the below mentioned path :
There is a toolbar option on the profile page, just uncheck the checkbox which is saying “Show toolbar when viewing site”. So, the toolbar for current user will not show untill we uncheck this checkbox again.
In the same way we can hide or disable this toolbar for any of the website users from their profile settings.
Using a plugin :
We can disable the toolbar by installing a plugin to the admin plugin section. There are so many plugins available to hide this toolbar permanently for all type of users. Just go to admin add new plugin section and search for “Global Hide Admin Toolbar” and install the plugin from it.
Using a css :
In this same reference, we can do this by adding a css to the style.css file of your activated theme. We can add below mentioned css :
But it is bad practice to hide the admin bar by using the above mentioned css.
Code in Functions.php :
It is the best way to hide the admin bar among all of the discussed above. We just need to put a line of code in our functions.php file of our currently activated theme. Use code :
putting the above mentioned code will hide the admin bar from the frontend and it will remain working for all admin pages, which is a most correct and easy way.