Skip to content

Instantly share code, notes, and snippets.

@beatwiz
Last active March 22, 2018 16:11
Show Gist options
  • Save beatwiz/888d97458c53cdff315ba3de08368b25 to your computer and use it in GitHub Desktop.
Save beatwiz/888d97458c53cdff315ba3de08368b25 to your computer and use it in GitHub Desktop.
[wordpress] Disable wordpress top bar for all users except admin
<?php
//DISABLE TOP BAR FOR ALL USERS EXCEPT ADMIN
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment