Removing “Sub-menus” from My Sites Drop-down in Admin Bar

How does one remove the “sub-menu” that appears to the right of each site listed in the My Sites drop down from the admin bar?

That is, I want to have a list of My Sites without the Dashboard/New Post/Manage Comments/Visit Site links appearing to the right of the arrow for each site in the My Sites drop down list.

This would simplify the user interface significantly for my users.

Any guidance would be greatly appreciated. Thank you.

1 Answer
1

Old question but I just came accros a fix.

I hope it helps someone else.

Add this to your theme functions.php file

add_action( 'wp_before_admin_bar_render', 'remove_mysites_comment_link' );
function remove_mysites_comment_link () {
    global $wp_admin_bar;
    foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
        $menu_id_c="blog-" . $blog->userblog_id . '-c';
        $wp_admin_bar->remove_menu($menu_id_c);
    }
}

Leave a Comment