Created
April 16, 2012 18:20
-
-
Save menslow/2400487 to your computer and use it in GitHub Desktop.
WordPress: Add filter to control which users see the admin bar.
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
/** | |
* mm_show_admin_bar function. | |
* Filter to control which users see the admin bar. | |
* @access public | |
* @return false or true if user is admin. | |
*/ | |
function mm_show_admin_bar() { | |
if (current_user_can('administrator')) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
// Hide admin bar | |
add_filter( 'show_admin_bar', 'mm_show_admin_bar' ); |
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
/** | |
* mm_show_admin_bar function. | |
* Filter to control which users see the admin bar. | |
* @access public | |
* @return false or true if user is admin. | |
*/ | |
function mm_show_admin_bar() { | |
if(is_admin()) | |
{ | |
return true; | |
} | |
return false; | |
} | |
// Hide admin bar | |
add_filter( 'show_admin_bar', 'mm_show_admin_bar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment