wp_cache_switch_to_blog() WordPress Function

The wp_cache_switch_to_blog() function is used to change the current blog in the WordPress cache. This is useful for when you need to access data from another blog in the WordPress installation.

wp_cache_switch_to_blog( int $blog_id ) #

Switches the internal blog ID.


Description

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

Top ↑

See also


Top ↑

Parameters

$blog_id

(int)(Required)Site ID.


Top ↑

Source

File: wp-includes/cache.php

function wp_cache_switch_to_blog( $blog_id ) {
	global $wp_object_cache;

	$wp_object_cache->switch_to_blog( $blog_id );
}


Top ↑

Changelog

Changelog
VersionDescription
3.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.