switch_to_blog

Switch the current blog.

Description

(int) switch_to_blog( (mixed) $new_blog, (null) $deprecated = null ); 

Returns (int)

Parameters (2)

0. $new_blog (mixed)
New blog to switch to. Not used.
1. $deprecated — Optional. (null) => null
Whether or not deprecated. Not used.

Usage

  1. if ( !function_exists( 'switch_to_blog' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-wpabstraction.php'; 
  3.  
  4. // New blog to switch to. Not used. 
  5. $new_blog = null; 
  6.  
  7. // Whether or not deprecated. Not used. 
  8. $deprecated = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = switch_to_blog($new_blog, $deprecated); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-wpabstraction.php  
  1. function switch_to_blog( $new_blog, $deprecated = null ) { 
  2. return bp_get_root_blog_id();