WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/08/2016 10:32:47 PM (3 years ago)
Author:
jeremyfelt
Message:

Multisite: Use get_current_blog_id() in get_site() for current site.

The global $current_blog is not switched in switch_to_blog() and can
not be used to properly retrieve current switched site information.

See #37607.

File:
1 edited

Legend:

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

    r38125 r38217  
    479479 * @since 4.6.0
    480480 *
    481  * @global WP_Site $current_blog The current site.
    482  *
    483481 * @param WP_Site|int|null $site Optional. Site to retrieve. Default is the current site.
    484482 * @return WP_Site|null The site object or null if not found.
    485483 */
    486484function get_site( &$site = null ) {
    487     global $current_blog;
    488     if ( empty( $site ) && isset( $current_blog ) ) {
    489         $site = $current_blog;
     485    if ( empty( $site ) ) {
     486        $site = get_current_blog_id();
    490487    }
    491488
Note: See TracChangeset for help on using the changeset viewer.