WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 4 times in this file.
| Line | Code |
|---|---|
| 474 | if ( empty($switched_stack) ) |
| 475 | $switched_stack = array(); |
| 476 | |
| 477 | $switched_stack[] = $blog_id; |
| 478 | |
| 479 | /* If we're switching to the same blog id that we're on, |
| 480 | * set the right vars, do the associated actions, but skip |
| 481 | * the extra unnecessary work */ |
| 482 | if ( $blog_id == $new_blog ) { |
| 483 | do_action( 'switch_blog', $blog_id, $blog_id ); |
| 484 | $switched = true; |
| 485 | return true; |
| 486 | } |
| 487 | |
| 488 | $wpdb->set_blog_id($new_blog); |
| 489 | $table_prefix = $wpdb->prefix; |
| 490 | $prev_blog_id = $blog_id; |
| 491 | $blog_id = $new_blog; |
| 492 | |
| Line | Code |
| 513 | wp_cache_init(); |
| 514 | if ( function_exists('wp_cache_add_global_groups') ) { |
| 515 | if ( is_array( $global_groups ) ) |
| 516 | wp_cache_add_global_groups( $global_groups ); |
| 517 | else |
| 518 | wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); |
| 519 | wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); |
| 520 | } |
| 521 | |
| 522 | do_action('switch_blog', $blog_id, $prev_blog_id); |
| 523 | $switched = true; |
| 524 | return true; |
| 525 | } |
| 526 | |
| 527 | /** |
| 528 | * Restore the current blog, after calling switch_to_blog() |
| 529 | * |
| 530 | * @see switch_to_blog() |
| 531 | * @since MU |
| Line | Code |
| 537 | |
| 538 | if ( !$switched ) |
| 539 | return false; |
| 540 | |
| 541 | if ( !is_array( $switched_stack ) ) |
| 542 | return false; |
| 543 | |
| 544 | $blog = array_pop( $switched_stack ); |
| 545 | if ( $blog_id == $blog ) { |
| 546 | do_action( 'switch_blog', $blog, $blog ); |
| 547 | /* If we still have items in the switched stack, consider ourselves still 'switched' */ |
| 548 | $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 ); |
| 549 | return true; |
| 550 | } |
| 551 | |
| 552 | $wpdb->set_blog_id($blog); |
| 553 | $prev_blog_id = $blog_id; |
| 554 | $blog_id = $blog; |
| 555 | $table_prefix = $wpdb->prefix; |
| Line | Code |
| 577 | wp_cache_init(); |
| 578 | if ( function_exists('wp_cache_add_global_groups') ) { |
| 579 | if ( is_array( $global_groups ) ) |
| 580 | wp_cache_add_global_groups( $global_groups ); |
| 581 | else |
| 582 | wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); |
| 583 | wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); |
| 584 | } |
| 585 | |
| 586 | do_action('switch_blog', $blog_id, $prev_blog_id); |
| 587 | |
| 588 | /* If we still have items in the switched stack, consider ourselves still 'switched' */ |
| 589 | $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 ); |
| 590 | return true; |
| 591 | } |
| 592 | |
| 593 | /** |
| 594 | * Check if a particular blog is archived. |
| 595 | * |