Make WordPress Core


Ignore:
Timestamp:
10/19/2023 07:07:13 PM (16 months ago)
Author:
flixos90
Message:

Multisite: Ensure that switching sites resets the current theme directory globals.

The globals introduced in [56635] to cache the current theme directories in memory were not considering switching sites in a multisite network. This changeset addresses the bug including test coverage.

Props codex-m, jeremyfelt.
Fixes #59677.
See #18298.

File:
1 edited

Legend:

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

    r55990 r56974  
    492492 * @global bool            $switched
    493493 * @global string          $table_prefix
     494 * @global string          $wp_template_path
     495 * @global string          $wp_stylesheet_path
    494496 * @global WP_Object_Cache $wp_object_cache
    495497 *
     
    533535
    534536    $wpdb->set_blog_id( $new_blog_id );
    535     $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
    536     $GLOBALS['blog_id']      = $new_blog_id;
     537    $GLOBALS['table_prefix']       = $wpdb->get_blog_prefix();
     538    $GLOBALS['blog_id']            = $new_blog_id;
     539    $GLOBALS['wp_template_path']   = null;
     540    $GLOBALS['wp_stylesheet_path'] = null;
    537541
    538542    if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
     
    601605 * @global bool            $switched
    602606 * @global string          $table_prefix
     607 * @global string          $wp_template_path
     608 * @global string          $wp_stylesheet_path
    603609 * @global WP_Object_Cache $wp_object_cache
    604610 *
     
    626632
    627633    $wpdb->set_blog_id( $new_blog_id );
    628     $GLOBALS['blog_id']      = $new_blog_id;
    629     $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
     634    $GLOBALS['blog_id']            = $new_blog_id;
     635    $GLOBALS['table_prefix']       = $wpdb->get_blog_prefix();
     636    $GLOBALS['wp_template_path']   = null;
     637    $GLOBALS['wp_stylesheet_path'] = null;
    630638
    631639    if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
Note: See TracChangeset for help on using the changeset viewer.