Remove Menu Items From WordPress Admin Bar

Remove Menu Items From WordPress Admin Bar

Ever want to remove items from the WordPress Admin Bar? If yes – there is a simple way to handle this using a few steps:

  1. Identify what you want to remove.
  2. View the page source and find the CSS ID of the item you want to remove (see screenshot). Note whatever comes after “wp-admin-bar-“. Example: wp-admin-bar-dashboard – you would note “dashboard”
  3. Add the following code into your theme’s functions.php file and customize the “CSS ID” that you want to remove. (The example below will remove the dashboard link)
/**
 *  Remove Dashboard Link for subscribers
 *
*/
add_action( 'wp_before_admin_bar_render', 'sdac_custom_admin_bar' );
function sdac_custom_admin_bar() {
    global $wp_admin_bar;
    $wp_admin_bar->remove_menu('dashboard');
}

dashboard

Leave a Reply

Your email address will not be published.
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.