Are you developing a WordPress website and want hide admin toolbar from front-end website for non-WordPress users. Open the functions.php file and copy paste below code at the end of the file and save it.
Below code will hide the admin toolbar to all logged in users except admins only.
This code is very useful for the membership website or those websites which allow user registration from front-end websites.
1 2 3 4 5 6 |
//hide admin tool bar from front-end! if (!current_user_can('administrator')) { show_admin_bar(false); endif; } |
You can also do this by using a WordPress plugin named “Hide Admin Bar from Non-Admins“. This plugin will automatically remove the admin toolbar from front-end site. Download the latest version of this plugin from below link and install it into your website.
The installation of this plugin is very simple and easy as other WordPress plugins are. If you have just started with WordPress, Read:
After installation of this plugin, no need to configure, It will automatically work.
Do you like & share this tutorial with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials. Also, subscribe my blog to get every future WordPress tips and tricks directly in your mailbox.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: hide admin bar in wordpress, wordpress tutorial, wordpress tutorial for beginner, wordpress tutorial for beginners, wordpress tutorials, wordpress tutorials for beginners, wordpress tutorils