Multisite: Handle get_id_from_blogname() lookups when the network domain has www..

Previously, if a network's domain started with `www.` in a subdomain configuration, a slug lookup with `get_id_from_blogname()` would not match an existing site. A similar lookup in a subdirectory configuration would work fine.

This strips `www.` from the network's domain in a subdomain configuration during the lookup and returns the site as expected.

Adds tests which would previously fail in a subdomain configuration, but now pass in both configurations.

Props igmoweb, flixos90.
Fixes #34450.


git-svn-id: https://develop.svn.wordpress.org/trunk@38658 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2016-09-27 17:56:53 +00:00
parent 61f014b9fc
commit 1f143d995b
2 changed files with 113 additions and 1 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ function get_id_from_blogname( $slug ) {
return $blog_id;
if ( is_subdomain_install() ) {
$domain = $slug . '.' . $current_site->domain;
$domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
$path = $current_site->path;
} else {
$domain = $current_site->domain;