diff --git a/wp-includes/embed.php b/wp-includes/embed.php index 8ca7f80d5b..19b3f9cb4d 100644 --- a/wp-includes/embed.php +++ b/wp-includes/embed.php @@ -1071,6 +1071,8 @@ function the_embed_site_title() { * Null if the URL does not belong to the current site. */ function wp_filter_pre_oembed_result( $result, $url, $args ) { + $switched_blog = false; + if ( is_multisite() ) { $url_parts = wp_parse_args( wp_parse_url( $url ), array( 'host' => '', @@ -1094,6 +1096,7 @@ function wp_filter_pre_oembed_result( $result, $url, $args ) { if ( $site && (int) $site->blog_id !== get_current_blog_id() ) { switch_to_blog( $site->blog_id ); + $switched_blog = true; } } @@ -1111,7 +1114,7 @@ function wp_filter_pre_oembed_result( $result, $url, $args ) { $data = get_oembed_response_data( $post_id, $width ); $data = _wp_oembed_get_object()->data2html( (object) $data, $url ); - if ( is_multisite() && ms_is_switched() ) { + if ( $switched_blog ) { restore_current_blog(); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 55511f19ef..63bc371518 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41605'; +$wp_version = '4.9-alpha-41606'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.