Disables the #wpadmin bar for users without "edit_posts" permissions.
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 | |
/** | |
* Disables the #wpadmin bar for users without "edit_posts" permissions. | |
*/ | |
function prefix_hide_admin_bar() { | |
if ( ! current_user_can( 'edit_posts' ) ) { | |
add_filter( 'show_admin_bar', '__return_false' ); | |
} | |
} | |
add_action( 'after_setup_theme', 'prefix_hide_admin_bar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment