Snippet

Simplify Your WordPress Admin: Hide Unnecessary Toolbar Elements

How to hide menu items in wordpress adminRemove unnecessary wordpress admin menu itemsHide wordpress admin bar itemsWordpress admin panel cleanupSimplify wordpress admin menuWordpress admin menu customizationHide wordpress dashboard elementsWordpress admin menu editor pluginRemove clutter from wordpress adminCustomize wordpress admin toolbar

Explanation

Want to tidy up your WordPress admin area? Here's a simple way to hide those elements you don't need.

Remove Menu Items:

  • Get rid of menu items like Comments, Tools, Posts, Pages, and Media. This makes your admin menu less cluttered.

Clean Up the Admin Bar:

  • Remove the WordPress logo, Comments, New Content, and Updates from the admin bar. This keeps it neat and focused on what you need.

Streamline the Dashboard:

  • Hide widgets like Quick Draft, Recent Drafts, WordPress Events and News, and Activity. This helps you focus on the essentials.

Customize Further:

  • For example, you can hide the 'Help' tab to keep things simple.

These tweaks make your WordPress admin area cleaner and more efficient, helping you focus on what matters most.

Code

1<?php 2// Hook into 'admin_menu' to remove unnecessary admin menu items 3function wp_dudecom_customize_admin_menu() { 4 // Remove specific menu items 5 remove_menu_page('edit-comments.php'); // Comments 6 remove_menu_page('tools.php'); // Tools 7 remove_menu_page('edit.php'); // Posts 8 remove_menu_page('edit.php?post_type=page'); // Pages 9 remove_menu_page('upload.php'); // Media 10} 11add_action('admin_menu', 'wp_dudecom_customize_admin_menu'); 12 13// Hook into 'wp_before_admin_bar_render' to remove unnecessary admin bar items 14function wp_dudecom_customize_admin_bar() { 15 global $wp_admin_bar; 16 17 // Remove specific admin bar items 18 $wp_admin_bar->remove_node('wp-logo'); // WordPress logo 19 $wp_admin_bar->remove_node('comments'); // Comments 20 $wp_admin_bar->remove_node('new-content'); // New content 21 $wp_admin_bar->remove_node('updates'); // Updates 22} 23add_action('wp_before_admin_bar_render', 'wp_dudecom_customize_admin_bar'); 24 25// Hook into 'wp_dashboard_setup' to remove unnecessary dashboard widgets 26function wp_dudecom_customize_dashboard_widgets() { 27 // Remove specific dashboard widgets 28 remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Quick Draft 29 remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side'); // Recent Drafts 30 remove_meta_box('dashboard_primary', 'dashboard', 'side'); // WordPress Events and News 31 remove_meta_box('dashboard_secondary', 'dashboard', 'side'); // Secondary 32 remove_meta_box('dashboard_activity', 'dashboard', 'normal'); // Activity 33} 34add_action('wp_dashboard_setup', 'wp_dudecom_customize_dashboard_widgets'); 35 36// Hook into 'admin_init' to customize the admin panel further 37function wp_dudecom_customize_admin_panel() { 38 // Example: Hide the 'Help' tab 39 add_filter('contextual_help', '__return_false', 999); 40} 41add_action('admin_init', 'wp_dudecom_customize_admin_panel'); 42?>

Instructions

File Location: Add the following code to your theme's functions.php file or a custom plugin file.

Prerequisites:

  • Ensure you have access to your WordPress theme files or the ability to create/edit a custom plugin.
  • Backup your site before making changes to the code.

Implementation Steps:

  1. Log in to your WordPress admin dashboard.
  2. Navigate to Appearance > Theme Editor if you are editing the functions.php file, or go to Plugins > Add New to create a new plugin.
  3. If using the Theme Editor, select the functions.php file from the list on the right.
  4. If creating a new plugin, click on Create a new plugin and give it a name. Open the main plugin file for editing.
  5. Copy the provided code snippet and paste it at the end of the functions.php file or the main plugin file.
  6. Save the changes by clicking the Update File button if using the Theme Editor, or Save if using a plugin editor.
  7. Refresh your WordPress admin dashboard to see the changes take effect.

These steps will help you hide unnecessary elements from your WordPress admin area, making it cleaner and more efficient.

If you need further assistance or want to explore more advanced customizations, consider reaching out to wp-dude.com for expert help.