I’d like to hide certain menus like Media, Privacy, and Permalinks. I’ve been using the following code to hide entire parent menus but not sure how to go about for submenus.
function remove_menus () {
global $menu;
$restricted = array(__('Links'), __('Comments'), __('Appearance'), __('Tools'));
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');