Posted By

zac on 02/21/11


Tagged

wordpress functions


Versions (?)

remove menus for all but admin


 / Published in: PHP
 

  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  

You need to login to post a comment.