Remove Main site from admin bar

Is it possible to remove the main site from showing in the admin bar of a user that is not superadmin?

I am not using the main site for anything other than hosting the Multisite, with all info about the service on a separate domain, so if a user clicks on there, it doesn't look too good.

Thanks.

  • Ivan
    • HummingBird

    Hey there Dark Scream,

    Hope you are having great weekend!

    Unfortunately I am not able to give you with an easy solution to remove just one site from the menu.

    That would require removing the whole menu, and then adding every site one by one, and the new one won't appear.

    You can use this code if you want to remove the whole "My Sites" menu:

    function wpmu_remove_my_sites( $wp_admin_bar ) {
    $wp_admin_bar->remove_node('my-sites');
    }
    add_action( 'admin_bar_menu', 'wpmu_remove_my_sites', 999 );

    You can place it on the bottom of your theme functions.php file.

    Or you can simply use our Custom Admin Bar plugin which have more options that just removing "My Sites" menu.

    Additionally I can mark this to the attention of our SLS guys, but I am still not sure if there is easy to remove just one site as they are generated dynamically.

    Thanks,
    Ivan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.