WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/19/2016 04:46:14 AM (3 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/link-template.php

    r38698 r38814  
    32563256        return site_url($path, $scheme);
    32573257
    3258     $current_site = get_current_site();
     3258    $current_network = get_network();
    32593259
    32603260    if ( 'relative' == $scheme )
    3261         $url = $current_site->path;
     3261        $url = $current_network->path;
    32623262    else
    3263         $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
     3263        $url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
    32643264
    32653265    if ( $path && is_string( $path ) )
     
    32983298        return home_url($path, $scheme);
    32993299
    3300     $current_site = get_current_site();
     3300    $current_network = get_network();
    33013301    $orig_scheme = $scheme;
    33023302
     
    33053305
    33063306    if ( 'relative' == $scheme )
    3307         $url = $current_site->path;
     3307        $url = $current_network->path;
    33083308    else
    3309         $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
     3309        $url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
    33103310
    33113311    if ( $path && is_string( $path ) )
Note: See TracChangeset for help on using the changeset viewer.