Multisite: Implement the get_by_path method in WP_Network.

Move the internals of `get_network_by_path()` to `WP_Network()` and allow network objects to be retrieved by passing a requested domain and path.

Props johnjamesjacoby, jeremyfelt, drewapicture, wonderboymusic.
See #31985.


git-svn-id: https://develop.svn.wordpress.org/trunk@34099 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2015-09-13 23:39:20 +00:00
parent f20622f394
commit 13dd966554
3 changed files with 159 additions and 135 deletions
+2 -2
View File
@@ -87,7 +87,7 @@ if ( !isset( $current_site ) || !isset( $current_blog ) ) {
}
}
if ( empty( $current_site ) ) {
$current_site = get_network_by_path( $domain, $path, 1 );
$current_site = WP_Network::get_by_path( $domain, $path, 1 );
}
if ( empty( $current_site ) ) {
@@ -118,7 +118,7 @@ if ( !isset( $current_site ) || !isset( $current_blog ) ) {
$current_site = WP_Network::get_instance( $current_blog->site_id ? $current_blog->site_id : 1 );
} else {
// If you don't have a site with the same domain/path as a network, you're pretty screwed, but:
$current_site = get_network_by_path( $domain, $path, 1 );
$current_site = WP_Network::get_by_path( $domain, $path, 1 );
}
}