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 |
---|---|
463 | if ( empty($switched_stack) ) |
464 | $switched_stack = array(); |
465 |
|
466 | $switched_stack[] = $blog_id; |
467 |
|
468 | /* If we're switching to the same blog id that we're on, |
469 | * set the right vars, do the associated actions, but skip |
470 | * the extra unnecessary work */ |
471 | if ( $blog_id == $new_blog ) { |
472 | do_action( 'switch_blog', $blog_id, $blog_id ); |
473 | $switched = true; |
474 | return true; |
475 | } |
476 |
|
477 | $wpdb->set_blog_id($new_blog); |
478 | $table_prefix = $wpdb->prefix; |
479 | $prev_blog_id = $blog_id; |
480 | $blog_id = $new_blog; |
481 |
|
Line | Code |
502 | wp_cache_init(); |
503 | if ( function_exists('wp_cache_add_global_groups') ) { |
504 | if ( is_array( $global_groups ) ) |
505 | wp_cache_add_global_groups( $global_groups ); |
506 | else |
507 | wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); |
508 | wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); |
509 | } |
510 |
|
511 | do_action('switch_blog', $blog_id, $prev_blog_id); |
512 | $switched = true; |
513 | return true; |
514 | } |
515 |
|
516 | /** |
517 | * Restore the current blog, after calling switch_to_blog() |
518 | * |
519 | * @see switch_to_blog() |
520 | * @since MU |
Line | Code |
526 |
|
527 | if ( !$switched ) |
528 | return false; |
529 |
|
530 | if ( !is_array( $switched_stack ) ) |
531 | return false; |
532 |
|
533 | $blog = array_pop( $switched_stack ); |
534 | if ( $blog_id == $blog ) { |
535 | do_action( 'switch_blog', $blog, $blog ); |
536 | /* If we still have items in the switched stack, consider ourselves still 'switched' */ |
537 | $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 ); |
538 | return true; |
539 | } |
540 |
|
541 | $wpdb->set_blog_id($blog); |
542 | $prev_blog_id = $blog_id; |
543 | $blog_id = $blog; |
544 | $table_prefix = $wpdb->prefix; |
Line | Code |
566 | wp_cache_init(); |
567 | if ( function_exists('wp_cache_add_global_groups') ) { |
568 | if ( is_array( $global_groups ) ) |
569 | wp_cache_add_global_groups( $global_groups ); |
570 | else |
571 | wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) ); |
572 | wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); |
573 | } |
574 |
|
575 | do_action('switch_blog', $blog_id, $prev_blog_id); |
576 |
|
577 | /* If we still have items in the switched stack, consider ourselves still 'switched' */ |
578 | $switched = ( is_array( $switched_stack ) && count( $switched_stack ) > 0 ); |
579 | return true; |
580 | } |
581 |
|
582 | /** |
583 | * Check if a particular blog is archived. |
584 | * |