Last active
December 14, 2020 19:51
-
-
Save iamgaby7521/8af94e0bb9520f9935b694a2b5e5872e to your computer and use it in GitHub Desktop.
Hide admin bar for WP
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 | |
/** | |
* Hide admin bar | |
*/ | |
// show admin bar only for admins | |
if ( ! current_user_can( 'manage_options' ) ) { | |
add_filter( 'show_admin_bar', '__return_false' ); | |
} | |
// show admin bar only for admins and editors | |
if ( ! current_user_can( 'edit_posts' ) ) { | |
add_filter( 'show_admin_bar', '__return_false' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment