Introduce wp_get_network() and begin cleanup of multisite load
|Reported by:||jeremyfelt||Owned by:|
During the multisite load process, we use wpmu_current_site() to process the requested URL into a matching network. The access to this function is marked as private, and it really does perform the one task—setting the $current_site global.
It wouldn't hurt to have a network retrieval function separate from this load process. Secondarily, the logic in wpmu_current_site() could use some cleanup.
The attached patch introduces wp_get_network() and reduces some of the cruft that is in wpmu_current_site().
- I dropped the $sites = query for sites that we use to check if only one network has been installed. I'm not convinced this saves any time, and from what I can tell we don't use the $sites global for anything else in core. This would clear out #26942
- Unfortunately, wp_get_network() must remain in ms-load.php for now, as ms-functions.php is not available yet. Not sure if this is something we should think about reorganizing.
- I have not had a chance to test this with multiple networks yet. A multisite, single network appears to work fine. More testing and feedback is very much necessary.
Change History (80)
3 years ago
- Keywords has-patch dev-feedback removed
- Type changed from enhancement to task (blessed)