remove menus for all but admin


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function remove_menus () {
  2. global $menu;
  3. if( (current_user_can('install_themes')) ) { $restricted = array(__('Links')); }
  4. else
  5. {$restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Settings'), __('Comments'), __('Plugins'));}
  6. end ($menu);
  7. while (prev($menu)){
  8. $value = explode(' ',$menu[key($menu)][0]);
  9. if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
  10. }
  11. }
  12. add_action('admin_menu', 'remove_menus');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.