Make WordPress Core

Ticket #49265: 49265.diff

File 49265.diff, 2.0 KB (added by SergeyBiryukov, 5 years ago)
  • src/wp-includes/ms-blogs.php

     
    508508                 * Fires when the blog is switched.
    509509                 *
    510510                 * @since MU (3.0.0)
     511                 * @since 5.4.0 The `$context` parameter was added.
    511512                 *
    512                  * @param int $new_blog_id  New blog ID.
    513                  * @param int $prev_blog_id Previous blog ID.
     513                 * @param int    $new_blog_id  New blog ID.
     514                 * @param int    $prev_blog_id Previous blog ID.
     515                 * @param string $context      Additional context. Accepts 'switch' when called from switch_to_blog()
     516                 *                             or 'restore' when called from restore_current_blog().
    514517                 */
    515                 do_action( 'switch_blog', $new_blog_id, $prev_blog_id );
     518                do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' );
    516519                $GLOBALS['switched'] = true;
    517520                return true;
    518521        }
     
    544547        }
    545548
    546549        /** This filter is documented in wp-includes/ms-blogs.php */
    547         do_action( 'switch_blog', $new_blog_id, $prev_blog_id );
     550        do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' );
    548551        $GLOBALS['switched'] = true;
    549552
    550553        return true;
     
    577580
    578581        if ( $new_blog_id == $prev_blog_id ) {
    579582                /** This filter is documented in wp-includes/ms-blogs.php */
    580                 do_action( 'switch_blog', $new_blog_id, $prev_blog_id );
     583                do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' );
    581584                // If we still have items in the switched stack, consider ourselves still 'switched'
    582585                $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
    583586                return true;
     
    611614        }
    612615
    613616        /** This filter is documented in wp-includes/ms-blogs.php */
    614         do_action( 'switch_blog', $new_blog_id, $prev_blog_id );
     617        do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' );
    615618
    616619        // If we still have items in the switched stack, consider ourselves still 'switched'
    617620        $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );