Advertisement
iftekharul

Remove unnecessary dashboard items

Apr 25th, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. /* Remove unnecessary dashboard items from Non-Admin */
  2. function remove_menus()
  3. {
  4.     global $menu;
  5.     global $current_user;
  6.     get_currentuserinfo();
  7.  
  8.     if($current_user->user_level < 10) {
  9.         $restricted = array(__('Pages'),
  10.                             __('Links'),
  11.                             __('Custom Post Name'), // This is custom post
  12.                             __('Appearance'),
  13.                             __('Plugins'),
  14.                             __('Tools'),
  15.                             __('Settings'),
  16.                     );
  17.         end ($menu);
  18.         while (prev($menu)) {
  19.             $value = explode(' ',$menu[key($menu)][0]);
  20.             if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
  21.         }
  22.     }
  23. }
  24. add_action('admin_menu', 'remove_menus');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement