[wp-trac] [WordPress Trac] #29684: Add get_main_site_id() function
WordPress Trac
noreply at wordpress.org
Fri Sep 8 15:40:12 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 flixos90):
[attachment:29684.15.diff] is a simplified patch solely focussing on
`get_main_site_id()` itself, as suggested in my last comment. It makes the
following changes to the function:
* Run `get_network()` in the very beginning of the function. If no network
found, the ID passed is invalid, so the function should return `0` then
regardless of the filter. The main reason for running `get_network()`
earlier is so that the `pre_get_main_site_id` is always passed an actual
ID and never `null` (this was previously possible).
* The `Tests_Multisite_Get_Main_Site_ID` class now is properly wrapped in
an `is_multisite()` checked and contains a docblock with the respective
test groups.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29684#comment:38>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list