How do I remove the WP Admin bar for non-admin users?

Some themes add a WP admin bar for all users that are logged in.

This code, if added using the Code Snippets plugin, will remove the admin bar for all users except for administrators:

add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us