Remove unnecessary menu items from Wordpress admin.


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

Simplify the Wordpress admin area for clients by hiding menu items. Add this snippet to your Wordpress theme's functions.php file.


Copy this code and paste it in your HTML
  1. /**
  2.  * Clean up admin menu to remove unnecessary items.
  3.  */
  4. function remove_admin_menus () {
  5. if (!current_user_can('manage_options')){ // Only proceed if user does not have admin role.
  6. remove_menu_page('index.php'); // Dashboard
  7. remove_menu_page('edit.php'); // Posts
  8. remove_menu_page('upload.php'); // Media
  9. remove_menu_page('link-manager.php'); // Links
  10. remove_menu_page('edit.php?post_type=page'); // Pages
  11. remove_menu_page('edit-comments.php'); // Comments
  12. remove_menu_page('themes.php'); // Appearance
  13. remove_menu_page('plugins.php'); // Plugins
  14. remove_menu_page('users.php'); // Users
  15. remove_menu_page('tools.php'); // Tools
  16. remove_menu_page('options-general.php'); // Settings
  17.  
  18. remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' ); // Remove posts->tags submenu
  19. remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=category' ); // Remove posts->categories submenu
  20. }
  21. }
  22. add_action('admin_menu', 'remove_admin_menus');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.