[wp-trac] [WordPress Trac] #33900: introduce get_current_network_id helper function
WordPress Trac
noreply at wordpress.org
Sun Apr 17 02:28:40 UTC 2016
#33900: introduce get_current_network_id helper function
--------------------------------+------------------------
Reporter: spacedmonkey | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.6
Component: Networks and Sites | Version: 4.4
Severity: normal | Resolution:
Keywords: has-patch | Focuses: multisite
--------------------------------+------------------------
Comment (by jeremyfelt):
Replying to [comment:8 johnjamesjacoby]:
> The second condition could maybe happen if `sunrise.php` was already in
place and wasn't using core functions to populate `$current_site`, and
honestly this seems likely for anyone that's using `sunrise.php` since the
only thing it is really great at is pre-populating those globals.
This should be mitigated by the check and re-assignment at the end of `ms-
settings.php`. So it seems like any real use of `get_current_network_id()`
by an mu-plugin, plugin, or theme would be after those objects are
properly available.
> Tangentially, the assumed `1` main network ID return value bothers me. A
new default constant makes sense here, itself defaulted to `1` in
WordPress core. And it can still be overridden in `sunrise.php` or `wp-
config.php`. It's edge-case, but I've already needed to kludge this
because a new network with a few sites took the place of the original one.
>
> So for each of the 3 cases, I'd like for the `1` default return value to
be configurable in some way. That could be handled in it's own ticket,
too, since it's a separate initiative and could cascade into the default
`$blog_id` too?
Should the default used in `get_current_network_id()` be based on
`get_main_network_id()`? We use the `PRIMARY_NETWORK_ID` (oops) constant
and `get_main_network_id` filters there that could be used to override.
That seems to be a safe assumption— main == default.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33900#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list