Make WordPress Core


Ignore:
Timestamp:
08/26/2016 09:34:36 PM (9 years ago)
Author:
wonderboymusic
Message:

Multisite: move get_current_site() to load.php so that it can be used in more places, instead of importing global $current_site.

See #37699.

File:
1 edited

Legend:

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

    r38386 r38388  
    42764276 * @since 3.0.0
    42774277 *
    4278  * @global object $current_site
    4279  *
    42804278 * @param int $site_id Optional. Site ID to test. Defaults to current site.
    42814279 * @return bool True if $site_id is the main site of the network, or if not
     
    42834281 */
    42844282function is_main_site( $site_id = null ) {
    4285     // This is the current network's information; 'site' is old terminology.
    4286     global $current_site;
    4287 
    4288     if ( ! is_multisite() )
     4283    if ( ! is_multisite() ) {
    42894284        return true;
    4290 
    4291     if ( ! $site_id )
     4285    }
     4286
     4287    if ( ! $site_id ) {
    42924288        $site_id = get_current_blog_id();
    4293 
    4294     return (int) $site_id === (int) $current_site->blog_id;
     4289    }
     4290    return (int) $site_id === (int) get_current_site()->blog_id;
    42954291}
    42964292
Note: See TracChangeset for help on using the changeset viewer.