Skip to content

Instantly share code, notes, and snippets.

@hayskytech
Last active August 20, 2022 00:58
Show Gist options
  • Save hayskytech/248d5570910f67c47a61693a8566ab14 to your computer and use it in GitHub Desktop.
Save hayskytech/248d5570910f67c47a61693a8566ab14 to your computer and use it in GitHub Desktop.
WP Hide Admin Bar for non-admin
<?php
function haysky_disable_admin_bar() {
if (current_user_can('administrator') ) {
show_admin_bar(true);
} else {
show_admin_bar(false);
}
}
add_action('after_setup_theme', 'haysky_disable_admin_bar');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment