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

WordPress Trac noreply at wordpress.org
Tue Jul 25 21:08:04 UTC 2017


#29684: Add get_main_site() function
-------------------------------------------------+-------------------------
 Reporter:  rmccue                               |       Owner:  flixos90
     Type:  enhancement                          |      Status:  accepted
 Priority:  normal                               |   Milestone:  4.9
Component:  Networks and Sites                   |     Version:  3.9
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:  multisite
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by spacedmonkey):

 That doesn't make any sense. Adding to `WP_Network` means it can be called
 from any context. The magic getter should do the fallback lookup. I think
 where possible we should be using `BLOG_ID_CURRENT_SITE` and
 `BLOGID_CURRENT_SITE` where possible, as these do not require a lookup.

 Replying to [comment:15 flixos90]:
 > I agree that there should definitely be a magic getter for the main site
 ID of `WP_Network`. But the actual code should be part of
 `get_main_site()` so that it can be called independently. The magic getter
 could then call `get_main_site()`.

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


More information about the wp-trac mailing list