Make WordPress Core


Ignore:
Timestamp:
09/27/2017 08:35:16 AM (9 years ago)
Author:
swissspidy
Message:

Embeds: Maintain switched state when embedding a post on Multisite.

Props bor0.
Fixes #40673.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/embed.php

    r41600 r41606  
    10721072 */
    10731073function wp_filter_pre_oembed_result( $result, $url, $args ) {
     1074        $switched_blog = false;
     1075
    10741076        if ( is_multisite() ) {
    10751077                $url_parts = wp_parse_args( wp_parse_url( $url ), array(
    … …  
    10951097                if ( $site && (int) $site->blog_id !== get_current_blog_id() ) {
    10961098                        switch_to_blog( $site->blog_id );
     1099                        $switched_blog = true;
    10971100                }
    10981101        }
    … …  
    11121115        $data = _wp_oembed_get_object()->data2html( (object) $data, $url );
    11131116
    1114         if ( is_multisite() && ms_is_switched() ) {
     1117        if ( $switched_blog ) {
    11151118                restore_current_blog();
    11161119        }
Note: See TracChangeset for help on using the changeset viewer.