-
-
Save pareshsojitra/e13fc1276cb6d266857627d7429be97d to your computer and use it in GitHub Desktop.
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