Make WordPress Core

Changeset 38231


Ignore:
Timestamp:
08/09/2016 04:19:58 PM (8 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.

Merge of [38217] to the 4.6 branch.

Props ocean90 for review.
Fixes #37607.

Location:
branches/4.6
Files:
1 added
1 edited

Legend:

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

    r38125 r38231  
    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.