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

WordPress Trac noreply at wordpress.org
Tue Aug 29 15:51:52 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:25 spacedmonkey]:
 > [https://core.trac.wordpress.org/attachment/ticket/29684/29684.9.diff
 29684.9.diff]
 >
 > Key changes.
 >
 > - Move get_main_site_id filter to top of function for better short
 circuit.

 If we move the filter to the top, we should probably name it
 `pre_get_main_site_id` to clarify that it's a short circuit. The docs will
 need to be moved in the patch as well.

 I've been going back and forth on whether we needed a filter at all. I
 could see the short circuit being more valuable than one at the end.

 > - Check to see if blog_id is set on network object.

 Unfortunately, we can't do this because if `blog_id` is not set, it's
 populated by `get_main_site_id()`. As is, the patch causes a segfault in
 PHP.

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


More information about the wp-trac mailing list