WP_Object_Cache::switch_to_blog()publicWP 3.5.0

Switches the internal blog ID.

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

Method of the class: WP_Object_Cache{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Object_Cache = new WP_Object_Cache();
$WP_Object_Cache->switch_to_blog( $blog_id );
$blog_id(int) (required)
Blog ID.

Changelog

Since 3.5.0 Introduced.

WP_Object_Cache::switch_to_blog() code WP 6.5.2

public function switch_to_blog( $blog_id ) {
	$blog_id           = (int) $blog_id;
	$this->blog_prefix = $this->multisite ? $blog_id . ':' : '';
}