Skip to content

Instantly share code, notes, and snippets.

@intelliweb
Created June 11, 2014 19:25
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 intelliweb/2e01824ed90b9687c1ec to your computer and use it in GitHub Desktop.
Save intelliweb/2e01824ed90b9687c1ec to your computer and use it in GitHub Desktop.
WP: remove/hide the WP admin bar for all users who cannot edit posts
<?php
// Remove WP admin bar for all users who can’t edit posts
add_action('set_current_user', 'intw_hide_admin_bar');
function intw_hide_admin_bar() {
if (!current_user_can('edit_posts')) {
show_admin_bar(false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment