Below is the code to disable WordPress admin bar for all users except for administrators.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'); |