[wp-hackers] Multisite options
mike at grady-etc.com
Mon Jan 20 16:07:06 UTC 2014
I don’t think there is a cleaner way to access that value then `$wpdb->base_prefix`. I wouldn’t use `$wpdb->get_blog_prefix()` — semantically that method is intended to retrieve the prefix for a specific blog, and passing 0 is a hack that won’t always work due to the issue you discovered.
The logic involving the `SUBDOMAIN_INSTALL` and `VHOST` constants is for backwards compatibility with pre-WP 3.0 installs.
Prior to WP 3.0 there was a separate code base dedicated to multisite — WPMU. There was no need for a `MULTISITE` constant as that was the only option you had. Instead, the `VHOST` constant was used to indicate whether or not it was a sub-domain or sub-directory install.
A fresh install of WPMU used `wp_1_` for the first blog prefix. When the single / MU codebases merged in WP 3.0, a fresh install used `wp_` for the first blog prefix. When converted to multisite (http://codex.wordpress.org/Create_A_Network), `wp_2_` was used for the next blog, so on and so on.
In order for WPMU-era installs to continue to work post-3.0, there are several places that use the definition of `MULTISITE` to decide which database prefix / uploads directory to use for the main site.
More information about the wp-hackers