[wp-trac] [WordPress Trac] #29684: Add get_main_site_id() function
WordPress Trac
noreply at wordpress.org
Tue Sep 12 15:24:51 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):
Replying to [comment:41 johnjamesjacoby]:
> * `get_main_site_for_network()`
> * `is_main_site_for_network()`
>
> I prefer these over `get_main_site_id()` which, similar to
`get_main_network_id()` insinuates that it's the single-one-and-only
primary main omega site ID for the entire installation, not for any
specific network. Put another way, it's the main site for the main
network, and that's it. If you want the main site for a network, use the
functions above.
I can see these names being more precise than what the patches so far do.
A possible issue I see is that `is_main_site()` already exists. We could
of course introduce `get_main_site_for_network()` and
`is_main_site_for_network()` (or, another idea, `get_network_main_site()`
and `is_network_main_site()`) and then defer `is_main_site()` to the new
function, passing the ID of the `$current_site` global as `$network_id`
parameter.
I personally don't think the names we've been working with so far are
really worse. In a regular multisite, they feel more straightforward, as
the "which network is it?" thing only matters for multi-network. My take
is for the most part that we should support multi-network as good as
possible, but still focus on common multisite for things like that.
An interesting observation is that core so far (what a surprise) doesn't
have a standard on this:
* We have `get_user_count()` and `get_blog_count()` which should rather be
called `get_network_user_count()` (yeah, it's a global count, but it's
still a network option) and `get_network_site_count()` ("site" only
because "blog" is obsolete) if following your suggestion.
* Other functions like `wp_update_network_user_counts()` or
`wp_update_network_site_counts()` are following your suggestion.
* Something to consider is that the functions discussed here would be
available on non-multisite as well. Having a term like "network" in the
function name may feel weird for these setups.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29684#comment:42>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list