WordPress.org

Make WordPress Core

Ticket #32450: 32450-switch_to_blog_wp_site_support.diff

File 32450-switch_to_blog_wp_site_support.diff, 707 bytes (added by BinaryKitten, 5 years ago)

add support to switch_to_blog for WP_Site

  • .gitignore

    diff --git .gitignore .gitignore
    index dd18e54..9730fb1 100644
    wp-tests-config.php 
    4242
    4343# Ignore other .gitignore files to allow for personal customizations
    4444.gitignore
     45.idea
     46 No newline at end of file
  • src/wp-includes/ms-blogs.php

    diff --git src/wp-includes/ms-blogs.php src/wp-includes/ms-blogs.php
    index 966fb73..c5e9f6d 100644
    function switch_to_blog( $new_blog, $deprecated = null ) { 
    603603        if ( empty( $new_blog ) )
    604604                $new_blog = $GLOBALS['blog_id'];
    605605
     606        if ( $new_blog instanceof WP_Site ) {
     607                $new_blog = $new_blog->blog_id;
     608        }
     609
    606610        $GLOBALS['_wp_switched_stack'][] = $GLOBALS['blog_id'];
    607611
    608612        /*