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/ms-default-constants.php

    r37985 r38814  
    4848 */
    4949function ms_cookie_constants(  ) {
    50     $current_site = get_current_site();
     50    $current_network = get_network();
    5151
    5252    /**
     
    5454     */
    5555    if ( !defined( 'COOKIEPATH' ) )
    56         define( 'COOKIEPATH', $current_site->path );
     56        define( 'COOKIEPATH', $current_network->path );
    5757
    5858    /**
     
    6060     */
    6161    if ( !defined( 'SITECOOKIEPATH' ) )
    62         define( 'SITECOOKIEPATH', $current_site->path );
     62        define( 'SITECOOKIEPATH', $current_network->path );
    6363
    6464    /**
     
    7777     */
    7878    if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
    79         if ( !empty( $current_site->cookie_domain ) )
    80             define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
     79        if ( !empty( $current_network->cookie_domain ) )
     80            define('COOKIE_DOMAIN', '.' . $current_network->cookie_domain);
    8181        else
    82             define('COOKIE_DOMAIN', '.' . $current_site->domain);
     82            define('COOKIE_DOMAIN', '.' . $current_network->domain);
    8383    }
    8484}
Note: See TracChangeset for help on using the changeset viewer.