Make WordPress Core


Ignore:
Timestamp:
10/19/2016 04:46:14 AM (8 years ago)
Author:
jeremyfelt
Message:

Multisite: Use get_network() and get_current_network_id() for current network data.

get_network() falls back to the current network when called without any arguments. Between this and get_current_network_id(), we can replace almost all instances of the global $current_site and all instances of get_current_site().

This effectively deprecates get_current_site(), something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-blogs.php

    r38659 r38814  
    8282 */
    8383function get_id_from_blogname( $slug ) {
    84     $current_site = get_current_site();
     84    $current_network = get_network();
    8585    $slug = trim( $slug, '/' );
    8686
    8787    if ( is_subdomain_install() ) {
    88         $domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
    89         $path = $current_site->path;
     88        $domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_network->domain );
     89        $path = $current_network->path;
    9090    } else {
    91         $domain = $current_site->domain;
    92         $path = $current_site->path . $slug . '/';
     91        $domain = $current_network->domain;
     92        $path = $current_network->path . $slug . '/';
    9393    }
    9494
Note: See TracChangeset for help on using the changeset viewer.