Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable WordPress admin bar for all users except for administrators. Source: http://www.wpbeginner.com/wp-tutorials/how-to-disable-wordpress-admin-bar-for-all-users-except-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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.