Ticket #40513: 40513.diff
File 40513.diff, 2.2 KB (added by , 7 years ago) |
---|
-
src/wp-includes/ms-blogs.php
788 788 * @global string $table_prefix 789 789 * @global WP_Object_Cache $wp_object_cache 790 790 * 791 * @param int $new_blog The id of the blog you want to switch to. Default: current blog791 * @param WP_Site|int $new_blog The id of the blog you want to switch to. Default: current blog 792 792 * @param bool $deprecated Deprecated argument 793 793 * @return true Always returns True. 794 794 */ … … 796 796 global $wpdb, $wp_roles; 797 797 798 798 $blog_id = get_current_blog_id(); 799 $site_object = false; 799 800 if ( empty( $new_blog ) ) { 800 801 $new_blog = $blog_id; 802 } else if ( $new_blog instanceof WP_Site ) { 803 $site_object = $new_blog; 804 $new_blog = $site_object->blog_id; 801 805 } 802 806 803 807 $GLOBALS['_wp_switched_stack'][] = $blog_id; … … 815 819 * 816 820 * @param int $new_blog New blog ID. 817 821 * @param int $new_blog Blog ID. 822 * @param WP_Site $site_object Optional Site object. 818 823 */ 819 do_action( 'switch_blog', $new_blog, $new_blog );824 do_action( 'switch_blog', $new_blog, $new_blog, $site_object ); 820 825 $GLOBALS['switched'] = true; 821 826 return true; 822 827 } … … 855 860 } 856 861 857 862 /** This filter is documented in wp-includes/ms-blogs.php */ 858 do_action( 'switch_blog', $new_blog, $prev_blog_id );863 do_action( 'switch_blog', $new_blog, $prev_blog_id, $site_object ); 859 864 $GLOBALS['switched'] = true; 860 865 861 866 return true; … … 888 893 889 894 if ( $blog_id == $blog ) { 890 895 /** This filter is documented in wp-includes/ms-blogs.php */ 891 do_action( 'switch_blog', $blog, $blog );896 do_action( 'switch_blog', $blog, $blog, false ); 892 897 // If we still have items in the switched stack, consider ourselves still 'switched' 893 898 $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); 894 899 return true; … … 929 934 } 930 935 931 936 /** This filter is documented in wp-includes/ms-blogs.php */ 932 do_action( 'switch_blog', $blog, $prev_blog_id );937 do_action( 'switch_blog', $blog, $prev_blog_id, false ); 933 938 934 939 // If we still have items in the switched stack, consider ourselves still 'switched' 935 940 $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );