removing dashboard menu options for the user role editor
- by styler
I want to remove some of the dashboard menu tabs on my wordpress site using this code:
//Remove some menu options
function remove_menus () {
global $menu;
$restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Contact'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
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_menus');
At the moment this removes the menus from all user roles, how could I update this to just apply to editors?
Ive also got this snippet of code but dont know how to combine it with what I have:
$editor = get_role(‘editor’);
$editor->remove_cap(‘publish_pages’);