In wordpress admin panel, if you want to hide certain menu's for non-admins , then add the below code in your current theme's functions.php file.
/* To hide menus for non -admin users*/
function remove_menus () {
global $menu;
$restricted = array(__('Dashboard'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('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)]);}
}
}
if(!is_super_admin()){
add_action('admin_menu', 'remove_menus');
}
No comments:
Post a Comment