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

WordPress Trac noreply at wordpress.org
Thu Jan 18 19:53:51 UTC 2024


#60290: Changeset #56635 breaks template loading in multisite network using
switch_to_blog()
-----------------------------+-----------------------------
 Reporter:  metropolis_john  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Themes           |    Version:  6.4.2
 Severity:  major            |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 The changes to the `locate_template()` function in
 https://core.trac.wordpress.org/changeset/56635 that replaced
 STYLESHEETPATH and TEMPLATEPATH constants with the relevant functions have
 broken the `get_template_part()` functionality in a multisite network that
 uses `switch_to_blog()`.

 Expected behavior: `get_template_part()` should only look in the active
 theme of the current site even after `switch_to_blog()` is used.

 In WP 6.4.2, if `switch_to_blog(1)` is used in site 2, then
 `get_template_part()` is called, only the active theme of site 1 is
 searched for the template part. `switch_to_blog()` should only affect
 database calls and should not allow theme developers to pull template
 parts from the theme of another site in a network.

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


More information about the wp-trac mailing list