Last active
March 30, 2016 22:03
-
-
Save theMikeD/571348f7e6ceab0fec812252d298aa47 to your computer and use it in GitHub Desktop.
Menu mods based on user role
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 Admin Menu Items For Editor | |
/----------------------------------------------------*/ | |
if( current_user_can('editor') ) { | |
function remove_editor_menus () { | |
global $menu; | |
$restricted = array(__('Dashboard'), __('Links'), __('FAQs'), __('FlexSlider'), __('Settings'), __('Comments')); | |
end ($menu); | |
while (prev($menu)){ | |
$value = explode(' ',$menu[key($menu)][0]); | |
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);} | |
} | |
} | |
add_action('admin_menu', 'remove_editor_menus'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment