WordPress at a glance
action is not described

switch_blog action-hook . WP MU

Fires when the blog is switched.

Usage

add_action( 'switch_blog', 'action_function_name_731', 10, 2 );
function action_function_name_731( $new_blog, $new_blog ){
	// action...
}
$new_blog(int)
New blog ID.
$new_blog(int)
Blog ID.

Notes

  • Since MU (3.0.0)

Where the hook is called

switch_to_blog()
restore_current_blog()
wp-includes/ms-blogs.php 825
do_action( 'switch_blog', $new_blog, $new_blog );
wp-includes/ms-blogs.php 858
do_action( 'switch_blog', $new_blog, $prev_blog_id );
wp-includes/ms-blogs.php 891
do_action( 'switch_blog', $blog, $blog );
wp-includes/ms-blogs.php 926
do_action( 'switch_blog', $blog, $prev_blog_id );

Where the hook is used (in WP core)

wp-includes/ms-default-filters.php 36
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
wp-includes/class-wp-roles.php 350
remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
wp-includes/class-wp-roles.php 354
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );