Last active
February 18, 2016 19:16
-
-
Save carlodaniele/2482f0d01e3e86817a04 to your computer and use it in GitHub Desktop.
Remove WordPress Toolbar for non-admin users
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 WordPress Toolbar for all users except admins and editors | |
* | |
*/ | |
function mytheme_remove_admin_bar() { | |
if ( ! current_user_can( 'publish_posts' ) ) { | |
show_admin_bar( false ); | |
} | |
} | |
add_action( 'after_setup_theme', 'mytheme_remove_admin_bar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment