update_site_cache

Advertisement

Summery Summery

Updates sites in cache.

Syntax Syntax

update_site_cache( array $sites, bool $update_meta_cache = true )

Parameters Parameters

$sites

(Required) Array of site objects.

$update_meta_cache

(Optional) Whether to update site meta cache.

Default value: true

Source Source

File: wp-includes/ms-site.php

 *
 * @since 4.6.0
 * @since 5.1.0 Introduced the `$update_meta_cache` parameter.
 *
 * @param array $sites             Array of site objects.
 * @param bool  $update_meta_cache Whether to update site meta cache. Default true.
 */
function update_site_cache( $sites, $update_meta_cache = true ) {
	if ( ! $sites ) {
		return;
	}
	$site_ids = array();
	foreach ( $sites as $site ) {
		$site_ids[] = $site->blog_id;
		wp_cache_add( $site->blog_id, $site, 'sites' );

Advertisement

Changelog Changelog

Changelog
Version Description
5.1.0 Introduced the $update_meta_cache parameter.
4.6.0 Introduced.

Advertisement

Leave a Reply