Created
November 3, 2018 17:20
-
-
Save bologer/891800e83a51554f29be8d868a3537fa to your computer and use it in GitHub Desktop.
Hide admin bar from users who cannot manage options
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 | |
/** | |
* Disable admin bar for users who cannot manage options. | |
*/ | |
function anycomment_disable_admin_bar() { | |
if ( is_plugin_active( 'anycomment/anycomment.php' ) ) { | |
if ( ! current_user_can( 'manage_options' ) ) { | |
show_admin_bar( false ); | |
} | |
} | |
} | |
add_action( 'init', 'anycomment_disable_admin_bar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment