WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
событие не описано

switch_blog хук-событие . WP 3.0.0

Fires when the blog is switched.

Использование

add_action( 'switch_blog', 'action_function_name_1480', 10, 3 );
function action_function_name_1480( $new_blog_id, $prev_blog_id, $context ){
	// action...
}
$new_blog_id(число)
New blog ID.
$prev_blog_id(число)
Previous blog ID.
$context(строка)
Additional context. Accepts 'switch' when called from switch_to_blog() or 'restore' when called from restore_current_blog().

Список изменений

С версии 3.0.0 Введена.
С версии 5.4.0 The $context parameter was added.

Где вызывается хук

switch_to_blog()
switch_blog
restore_current_blog()
switch_blog
wp-includes/ms-blogs.php 527
do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' );
wp-includes/ms-blogs.php 563
do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'switch' );
wp-includes/ms-blogs.php 597
do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' );
wp-includes/ms-blogs.php 634
do_action( 'switch_blog', $new_blog_id, $prev_blog_id, 'restore' );

Где используется хук в ядре WP

wp-includes/class-wp-roles.php 361
remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
wp-includes/class-wp-roles.php 365
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
wp-includes/ms-default-filters.php 37
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
wp-includes/ms-site.php 954
remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
wp-includes/ms-site.php 964
add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );