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-admin/includes/ms.php

    r38334 r38814  
    8989    update_blog_status( $blog_id, 'deleted', 1 );
    9090
    91     $current_site = get_current_site();
     91    $current_network = get_network();
    9292
    9393    // If a full blog object is not available, do not destroy anything.
     
    9797
    9898    // Don't destroy the initial, main, or root blog.
    99     if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) ) {
     99    if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_network->path && $blog->domain == $current_network->domain ) ) ) {
    100100        $drop = false;
    101101    }
Note: See TracChangeset for help on using the changeset viewer.