wp_cache_switch_to_blog

Switches the internal blog ID.

Description

wp_cache_switch_to_blog( (int) $blog_id ); 

This changes the blog id used to create keys in blog specific groups.

Parameters (1)

0. $blog_id (int)
The blog id.

Usage

  1. if ( !function_exists( 'wp_cache_switch_to_blog' ) ) { 
  2. require_once ABSPATH . WPINC . '/cache.php'; 
  3.  
  4. // The blog id. 
  5. $blog_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_cache_switch_to_blog($blog_id); 
  9.  

Defined (1)

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

/wp-includes/cache.php  
  1. function wp_cache_switch_to_blog( $blog_id ) { 
  2. global $wp_object_cache; 
  3.  
  4. $wp_object_cache->switch_to_blog( $blog_id );