I have made some restrictions on other user roles than the administrator. I've made it because I use WooCommerce.
I have added the following code to my themes functions.php file, and it works fine.
function remove_menus()
{
global $menu;
global $current_user;
get_currentuserinfo();
if($current_user->user_level < 10)
{
$restricted = array(__('Pages'),
__('Media'),
__('Links'),
__('Custom Post Name'),
__('Comments'),
__('Appearance'),
__('Plugins'),
__('Users'),
__('Tools'),
__('Settings'),
__('Posts'),
__('Produkter'),
__('Kontrolpanel'),
);
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}// end while
}// end if
}
add_action('admin_menu', 'remove_menus');
I want to hide "WooCommerce -> Settings", but I cannot figure out how to make it happen in the above code? Can someone help me?