Created
March 19, 2018 05:08
Hide the WordPress admin bar for non-admins
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 // For implementation instructions see: https://aceplugins.com/how-to-add-a-code-snippet/ | |
/** | |
* Hide admin bar for non-admins | |
*/ | |
function js_hide_admin_bar( $show ) { | |
if ( ! current_user_can( 'administrator' ) ) { | |
return false; | |
} | |
return $show; | |
} | |
add_filter( 'show_admin_bar', 'js_hide_admin_bar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment