Below is the code to disable WordPress admin bar for all users except for administrators.
<?php | |
//* Disable WordPress admin bar for all users except for administrators | |
function customprefix_remove_admin_bar() { | |
if (!current_user_can('administrator') && !is_admin()) { | |
show_admin_bar(false); | |
} | |
} | |
add_action('after_setup_theme', 'customprefix_remove_admin_bar'); |