Remove Admin Bar for all Users
-
Hi Guys,
I seem to be having a problem with removing the Admin Bar that runs across the front end site.
I am wanting to remove this and have tried almost every way I have read online.
Here are the steps I have done already:
1)
// Only display to administrators add_action('after_setup_theme', 'remove_admin_bar'); function remove_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } }
2)
// Disable for specific role (in this case, 'subscriber') function remove_admin_bar() { $user = wp_get_current_user(); if (in_array(‘subscriber’, $user->roles)) { show_admin_bar(false); } }
3)
add_filter('show_admin_bar', '__return_false');
4) Installed various plugins such as: Disable WP Admin Bar Removal – Remove Admin Bar – Global Hide Admin Bar and etc.
I cannot seem to get this bar removed. Has something changed in the code?
There is an option to Hide the bar in the user profiles, I do not want to do this everytime someone new joins the site as it is a magazine site.
Thanks
-
Try deactivating all plugins and use
add_filter('show_admin_bar', '__return_false');
in your functions file of the theme.Hi Jose,
Have tried that but no luck. Do you think of changing the core code to remove the admin bar is a good idea?
Please make sure that all plugins are deactivated. Does it happen if you are using a core bundled theme like Twenty Fourteen/Fifteen?
Hi Jose,
Looks like it is a theme related problem. Have contacted the theme developer. Can a theme prevent the admin bar from being hidden tho?
That is possible. Just seems strange that it would do that or even behave that way.
I’m glad you figured out what was causing it. 🙂
- The topic ‘Remove Admin Bar for all Users’ is closed to new replies.