×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Daniel Mulder
Added: Jan 15, 2016 11:16 AM
Views: 18
Tags: wordpress
Add snippet to (child) theme functions.php to hide admin bar for all non admin users.
  1. // show admin bar only for admins
  2. if (!current_user_can('manage_options')) {
  3.         add_filter('show_admin_bar', '__return_false');
  4. }
  5. // show admin bar only for admins and editors
  6. if (!current_user_can('edit_posts')) {
  7.         add_filter('show_admin_bar', '__return_false');
  8. }