Created
June 11, 2014 19:25
-
-
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
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
<?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