What is the file and line where WordPress determines which multi-site the user is on from the URL?
I’ve been looking through the code all afternoon and can’t figure out where it turns mysite.com/blogbase/myblog
into 2
(the ID). There’s a get_id_from_blogname()
function, but it doesn’t seem to be called on load?
Took a little while to run through, but this is where we end up.
On line 85 of
wp-settings.php
, it checks if theMULTISITE
constant has been defined. If so, it loads the multisite files that handle things like figuring out which blog you are on.One of those files is
/wp-includes/ms-settings.php
. I believe it decides which blog you are on at line 50.Basically,
$current_site
is a global stdClass that gets returned fromwpmu_current_site()
. Inms-settings.php
it overwrites it if it hasn’t already been forced via config settings.Also check out
/wp-includes/ms-load.php
for info onwpmu_current_site