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

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);
    }
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)