Remove WordPress Admin Bar

October 23, 2015   /   by Peter Johnson  / Categories :  Keeping A Clear Head, Snippets

Sometimes it is needed to remove the Admin bar at the top of each page when you are logged in to WordPress.

Examples

  1. A user / subscriber is logged in.
  2. While theming to see content at the top of the page.
  3. Its a pain in the A**.

To do this we can add a snippet to the Functions.php file.

For all users:

show_admin_bar(false);

For all users EXCEPT the Admin

if (!current_user_can('administrator')):
show_admin_bar(false);
endif;

0 comments

Leave a reply