From 7e71b1f827d8e5e4849bf64838d4da178d66a37d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 13 Feb 2015 12:53:25 +0000 Subject: [PATCH] Use `get_admin_url()` to get the correct My Sites URL without calling `switch_to_blog()` directly. props ocean90. see #31314. Built from https://develop.svn.wordpress.org/trunk@31448 git-svn-id: http://core.svn.wordpress.org/trunk@31429 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/admin-bar.php | 20 +++++++++----------- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index b4be9379af..0ad8d89487 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -333,13 +333,11 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) { if ( count( $wp_admin_bar->user->blogs ) < 1 && ! is_super_admin() ) return; - switch_to_blog( $wp_admin_bar->user->active_blog->blog_id ); $wp_admin_bar->add_menu( array( 'id' => 'my-sites', 'title' => __( 'My Sites' ), - 'href' => admin_url( 'my-sites.php' ), + 'href' => get_admin_url( $wp_admin_bar->user->active_blog->blog_id, 'my-sites.php' ), ) ); - restore_current_blog(); if ( is_super_admin() ) { $wp_admin_bar->add_group( array( @@ -681,10 +679,10 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) { } if ( current_theme_supports( 'widgets' ) ) { - $wp_admin_bar->add_menu( array( - 'parent' => 'appearance', - 'id' => 'widgets', - 'title' => __( 'Widgets' ), + $wp_admin_bar->add_menu( array( + 'parent' => 'appearance', + 'id' => 'widgets', + 'title' => __( 'Widgets' ), 'href' => admin_url( 'widgets.php' ), 'meta' => array( 'class' => 'hide-if-customize', @@ -692,10 +690,10 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) { ) ); if ( current_user_can( 'customize' ) ) { - $wp_admin_bar->add_menu( array( - 'parent' => 'appearance', - 'id' => 'customize-widgets', - 'title' => __( 'Widgets' ), + $wp_admin_bar->add_menu( array( + 'parent' => 'appearance', + 'id' => 'customize-widgets', + 'title' => __( 'Widgets' ), 'href' => add_query_arg( urlencode( 'autofocus[panel]' ), 'widgets', $customize_url ), // urlencode() needed due to #16859 'meta' => array( 'class' => 'hide-if-no-customize', diff --git a/wp-includes/version.php b/wp-includes/version.php index 01103d71be..0288f1a7cb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31447'; +$wp_version = '4.2-alpha-31448'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.