Wordpress: remove menu items


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

Remove menu items from the wordpress admin


Copy this code and paste it in your HTML
  1. /**
  2. * to remove items from the wordpress admin menu uncomment them from the list
  3. *
  4. *
  5. */
  6.  
  7. function remove_menus () {
  8. global $menu;
  9. $restricted = array(
  10. __('Dashboard'),
  11. __('Posts'),
  12. __('Media'),
  13. __('Links'),
  14. __('Pages'),
  15. __('Appearance'),
  16. __('Tools'),
  17. __('Users'),
  18. __('Settings'),
  19. __('Comments'),
  20. __('Plugins'),
  21. __('Gallery')
  22. );
  23. end ($menu);
  24.  
  25. while (prev($menu))
  26. {
  27. $value = explode(' ',$menu[key($menu)][0]);
  28. if(in_array($value[0] != NULL?$value[0]:"" , $restricted))
  29. {
  30. unset($menu[key($menu)]);
  31. }
  32. }
  33. }
  34. add_action('admin_menu', 'remove_menus');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.