wphats

Hide Admin Bar while viewing site

If you are logged in the wordpress site and viewing the front pages you will see Admin bar on Top. Sometimes it looks odd to see  while viewing the site. Personally, I don’t find much use for it. I feel it’s just a ugly bar to me while admin bar shows at top of the page with only some of the options. So, I quickly come up with this solution to hide/remove the admin bar from the front end while visiting site.

 

  • From Admin Panel (Current User only)
– Go to Dashboard
– Click Users->Your profile
– Uncheck “Show Toolbar when viewing site”
– Update Profile

 

  • From function.php file
    -> insert the below code to function.php file
    add_filter('show_admin_bar', '__return_false');

OR, show_admin_bar(false);

OR use below code for all users who can’t edit posts

  • From header.php file

-> insert the below code under wp_head() function

 

Choose a suitable option to use in your site to implement. Further if you have any problem you are feel free to ask through comment.

This post has already been read 982 times!

Mehedi Hasan

Cool WordPress Developer having much agile experience to develop any kind of WordPress sites & plugins. Also good in troubleshooting, fixing & making any kind of tweaks for WP site.

More Posts

POSTED ON: Wordpress Tricks
TAGGED :

Leave a Reply

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