WordPress.org

Make WordPress Core

Ticket #31314: 31314.diff

File 31314.diff, 615 bytes (added by simonwheatley, 5 years ago)

Wrap the add_menu call in switch_to_blog

  • wp-includes/admin-bar.php

     
    333333        if ( count( $wp_admin_bar->user->blogs ) < 1 && ! is_super_admin() )
    334334                return;
    335335
     336        switch_to_blog( get_user_meta( get_current_user_id(), 'primary_blog', true ) );
    336337        $wp_admin_bar->add_menu( array(
    337338                'id'    => 'my-sites',
    338339                'title' => __( 'My Sites' ),
    339340                'href'  => admin_url( 'my-sites.php' ),
    340341        ) );
     342        restore_current_blog();
    341343
    342344        if ( is_super_admin() ) {
    343345                $wp_admin_bar->add_group( array(