mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-31 13:37:51 +01:00
Embeds: Maintain switched state when embedding a post on Multisite.
Props bor0. Fixes #40673. Built from https://develop.svn.wordpress.org/trunk@41606 git-svn-id: http://core.svn.wordpress.org/trunk@41441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
db86c635ba
commit
81a8f1cffe
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user