Hide items from wp-admin menu


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



Copy this code and paste it in your HTML
  1. <?php
  2. function remove_dashboard_widgets() {
  3. global $menu,$submenu;
  4.  
  5. global $current_user;
  6. get_currentuserinfo();
  7.  
  8. if ($current_user->ID != 1) { // only admin sees the whole thing
  9. // $menu and $submenu will return fo all menu and submenu list in admin panel .
  10. $menu[2] = ""; //Dashboard
  11. $menu[5] = ""; // Posts
  12. $menu[15] = ""; //Links
  13. $menu[25] = ""; //Comments
  14. $menu[65] = ""; //Plugins
  15.  
  16. unset($submenu['themes.php'][5]); //themes
  17. unset($submenu['themes.php'][12]); //editor
  18. }
  19. }
  20. add_action('admin_head', 'remove_dashboard_widgets');
  21. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.