WordPress Snippet: Display admin bar only for admins | Tutorial Freak – Online Tutorials

WordPress Snippet: Display admin bar only for admins

Introduced in WordPress 3.3, the admin bar is a better version of the “Toolbar” which came with WordPress 3.0. The admin bar is useful only when you’re the blog admin though. When you’re a simple contributor, you don’t really need it. So why not get rid of it, except for admins?

Simply paste the following code into your functions.php file. Once saved, only admins will see the admin bar.

if (!current_user_can('manage_options')) {
	add_filter('show_admin_bar', '__return_false');
}

Author, Blogger, SEO Expert, Working Professional and a Student! I play so many roles in life and love what i do. I enjoy each moment of my life. Do follow us on Facebook

Sagar – who has written posts on Tutorial Freak – Online Tutorials.


Help keep us alive & kicking, we need coffee 24/7, please donate, thanks!
Embed

Leave a Reply

      
      
      
      
      
      
      
      
             
Save Now! $1.99 .COM at GoDaddy!
             
      
  • How to Configure User Groups in IPB