[wp-trac] [WordPress Trac] #37607: get_site() does not return the current site when multisite is in a switched state
WordPress Trac
noreply at wordpress.org
Mon Aug 8 21:42:09 UTC 2016
#37607: get_site() does not return the current site when multisite is in a switched
state
--------------------------------+-----------------------
Reporter: jeremyfelt | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.6
Component: Networks and Sites | Version: trunk
Severity: normal | Keywords: has-patch
Focuses: multisite |
--------------------------------+-----------------------
`get_site()` uses the global `$current_blog` as a fallback if a site ID is
not passed. When in a switched state via `switch_to_blog()`, this global
continues to contain the original site information. If `get_site()` is
called, then the originally loaded site will be returned, not that of the
switched site.
`$blog_id` should be used instead as it is modified during
`switch_to_blog()` and `restore_current_blog()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37607>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list