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

WordPress Trac noreply at wordpress.org
Fri Sep 15 11:14:52 UTC 2017


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

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"41380"]:
 {{{
 #!CommitTicketReference repository="" revision="41380"
 Multisite: Introduce `get_main_site_id()`.

 This function can be used to easily get the main site ID of a given
 network via the optional `$network_id` parameter, which defaults to the
 current network. The existing `is_main_site()` now uses the new function
 internally and now accepts an optional `$network_id` parameter as well.

 The main purpose of the new function at this point is to ensure that the
 `WP_Network::$blog_id` property is always set. Magic getters in the class
 have been adjusted to auto-fill the property when it is accessed and
 empty. Furthermore the function encapsulates logic that was previously
 part of `ms_load_current_site_and_network()` and has been replaced with a
 call to the function now.

 Props spacedmonkey, jeremyfelt, johnjamesjacoby, flixos90.
 Fixes #29684.
 }}}

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


More information about the wp-trac mailing list