[wp-trac] [WordPress Trac] #60290: Changeset #56635 breaks template loading in multisite network using switch_to_blog()

WordPress Trac noreply at wordpress.org
Wed Feb 21 19:24:33 UTC 2024


#60290: Changeset #56635 breaks template loading in multisite network using
switch_to_blog()
--------------------------------------+--------------------------
 Reporter:  metropolis_john           |       Owner:  joemcgill
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.5
Component:  Themes                    |     Version:  6.4.2
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+--------------------------
Changes (by joemcgill):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"57685" 57685]:
 {{{
 #!CommitTicketReference repository="" revision="57685"
 Themes: Use original template paths when switching blogs.

 This fixes a bug introduced by [57129] and [56635] in which deprecating
 the previous  `TEMPLATEPATH` and `STYLESHEETPATH` constants in favor of
 `get_template_directory()` and `get_stylesheet_directory()` functions
 caused the active theme template path to change when using
 `switch_to_blog()`.

 This introduces a new function, `wp_set_template_globals()`, which is
 called during the bootstrap process to store the template paths to new
 globals values `$wp_template_path` and `$wp_stylesheet_path`. This
 restores behavior to how things worked prior to [56635] but retains the
 ability for template values to be reset for better testability.

 Related #18298, #60025.

 Props joemcgill, flixos90, mukesh27, swissspidy, manfcarlo,
 metropolis_john, jeremyfelt.
 Fixes #60290.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60290#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list