Created
September 3, 2021 06:56
-
-
Save genesis16/4c13c5115d3d9eed6ddaa182f0bd4273 to your computer and use it in GitHub Desktop.
Disable admin bar from all non admins and editors
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
// Disabled wordpress admin bar to all non admininstrators or editors - Jane James | |
function disable_admin_bar() { | |
if (current_user_can('administrator') || current_user_can('editor') ) { | |
// user can view admin bar | |
show_admin_bar(true); // this line isn't essentially needed by default... | |
} else { | |
// hide admin bar | |
show_admin_bar(false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment