[wp-trac] [WordPress Trac] #29684: Add get_main_site_id() function

WordPress Trac noreply at wordpress.org
Mon Sep 11 17:08:22 UTC 2017


#29684: Add get_main_site_id() function
-------------------------------------------------+-------------------------
 Reporter:  rmccue                               |       Owner:  jeremyfelt
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  4.9
Component:  Networks and Sites                   |     Version:  3.9
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests ms-roadmap  |     Focuses:  multisite
-------------------------------------------------+-------------------------

Comment (by jeremyfelt):

 Replying to [comment:37 flixos90]:
 > I think we should leave the tests for switching to a site in another
 network out as we cannot expect `get_main_site_id()` to know the current
 network correctly, as there is no network switching in core.

 That's what makes a lot of this uglier than it should be. We do support
 switching between sites that are on different networks. If we can't
 reliably provide data in those cases, then we shouldn't provide something
 until it's possible.

 What if we step back to the beginning and think about a
 `get_main_site_id()` that does not support a `$network_id` parameter? It
 should only provide the main site for the current network.

 Is that useful enough to be introduced? If it is, I think that can happen
 without storing a network option and would simplify all of this
 significantly.

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


More information about the wp-trac mailing list