Last active
April 14, 2017 02:35
-
-
Save yuliyang/9040a9475afbe1edd34380412762f36c to your computer and use it in GitHub Desktop.
[WordPress] Disable admin bar for logged in users
This file contains hidden or 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 | |
function disable_admin_bar() { | |
if ( ! current_user_can('edit_posts') ) { | |
add_filter('show_admin_bar', '__return_false'); | |
} | |
} | |
add_action( 'after_setup_theme', 'disable_admin_bar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment