[wp-trac] [WordPress Trac] #25293: Switch_to_blog not switching the siteid
WordPress Trac
noreply at wordpress.org
Fri Jul 11 17:02:46 UTC 2025
#25293: Switch_to_blog not switching the siteid
------------------------------------+------------------------
Reporter: Rahe | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Networks and Sites | Version: 3.0
Severity: minor | Resolution: wontfix
Keywords: has-patch dev-feedback | Focuses: multisite
------------------------------------+------------------------
Changes (by johnjamesjacoby):
* keywords: has-patch dev-feedback 2nd-opinion => has-patch dev-feedback
* status: new => closed
* resolution: => wontfix
* milestone: Future Release =>
Comment:
This issue is closable thanks to #41507.
It replaced all usages of `$wpdb->siteid` with `get_current_network_id()`
– even though it was not **100%** functionally equivalent 😅💙
As of WordPress 4.9, `wpdb->sited` is no longer used internally by
WordPress core.
The class variable ''could'' be marked as deprecated via a new ticket
(same with the idea of switching networks?)
If anyone feels differently and wants to reopen this ticket, please do so!
----
[https://core.trac.wordpress.org/ticket/25293#comment:1 Jeremy's comment]
sums up my thoughts nicely. Attempting to introduce a new way to
independently switch sites & networks would likely require new
API/functions and a database query to pre-fetch the network object during
each switch.
(I also have a hard time thinking of a real-world use-case for switching
networks in a way that must be separate from switching sites, particularly
because the `wp_blogs.blog_id` database column is auto-incrementing. Even
in a tricked-out `sunrise.php` setup, you'd always query `wp_blogs` to get
all of the "details" and never consider querying `wp_site` ''first''
risking the miss and needing to fallback to `wp_blogs` for your lookup.)
----
Relevant & fun MU history:
* The second parameter of `wpdb::set_blog_id()` has accepted a
`$network_id` since [https://mu.trac.wordpress.org/changeset/1279/
mu1279], which was part of the WordPressMu 1.5.1 release.
* `wpdb->siteid` was used in [https://mu.trac.wordpress.org/ticket/726
#mu726], and no longer is.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25293#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list