Remove the main site from the “My Sites” dropdown in the toolbar

Remove the Main Site from the My Sites dropdown in the WordPress tool bar in a Multisite install

// remove main site from dropdown
function remove_main_blog_from_get_blogs($blogs) {
	// check that user is not Network Admin
	if ( !is_super_admin() ) {
		// remove first item from $blogs array, which should always be main blog
		array_splice($blogs, 0, 1);
	return $blogs;
add_filter( 'get_blogs_of_user', 'remove_main_blog_from_get_blogs' );