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_7034', 10, 2 );
function action_function_name_7034( $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()
switch_blog
restore_current_blog()
switch_blog
wp-includes/ms-blogs.php 514
do_action( 'switch_blog', $new_blog, $new_blog );
wp-includes/ms-blogs.php 547
do_action( 'switch_blog', $new_blog, $prev_blog_id );
wp-includes/ms-blogs.php 580
do_action( 'switch_blog', $blog, $blog );
wp-includes/ms-blogs.php 615
do_action( 'switch_blog', $blog, $prev_blog_id );

Where the hook is used (in WP core)

wp-includes/class-wp-roles.php 359
remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
wp-includes/class-wp-roles.php 363
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
wp-includes/ms-default-filters.php 36
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
wp-includes/ms-site.php 934
remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
wp-includes/ms-site.php 944
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );