Skip to content

Instantly share code, notes, and snippets.

@genesis16
Created September 3, 2021 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genesis16/4c13c5115d3d9eed6ddaa182f0bd4273 to your computer and use it in GitHub Desktop.
Save genesis16/4c13c5115d3d9eed6ddaa182f0bd4273 to your computer and use it in GitHub Desktop.
Disable admin bar from all non admins and editors
// 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