[wp-trac] [WordPress Trac] #29684: Add get_main_site_id() function
WordPress Trac
noreply at wordpress.org
Wed Sep 6 09:03:23 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 spacedmonkey):
I have been discussing this with @schlessera related to
[https://github.com/wp-cli/entity-command/issues/66 this] issue with WP-
CLI. Basically WP-CLI does currently allow you to delete main site on a
network. WP CLI introducts some weird edge cases. Like
- You delete main site network using WP-CLI.
- You edit main site's domain / path to not match the main site. This
would be mean the match the network domain.
Storing it network option allows you to easily change the main site,
fixing the above issues by creating a new site and making it main site in
options. You can already change the main site on a network using the
constants, but this isn't always as easy to do in a multi-network setups.
You also get benefits like
- Easy cache invalidation and management
- Main site can be primed in memory, by adding key to
`wp_load_core_site_options`
- On sites without object caching, it saves a query to the blogs table and
all the overhead that brings.
- Easy to find main site using WP CLI or other tools by just looking in
database.
I don't understand why it would just be a network option, if we are happy
with caching the result of the `get_sites` call, then why not just store
it forever...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29684#comment:36>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list