Last active
December 20, 2015 10:08
-
-
Save deadlyhifi/6112936 to your computer and use it in GitHub Desktop.
WordPress - disable admin bar.
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
/** | |
* Hide admin bar for all. | |
*/ | |
add_filter('show_admin_bar', '__return_false'); | |
or | |
/** | |
* Show admin bar only to those who can edit posts. | |
*/ | |
function dhf_hide_admin_bar() { | |
if (!current_user_can('edit_posts')) { | |
show_admin_bar(false); | |
} | |
} | |
add_action('set_current_user', 'dhf_hide_admin_bar'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment