A WordPress-centric search engine for devs and theme authors



update_site_cache ›

Since4.6.0
Deprecatedn/a
update_site_cache ( $sites, $update_meta_cache = true )
Parameters: (2)
  • (array) $sites Array of site objects.
    Required: Yes
  • (bool) $update_meta_cache Whether to update site meta cache. Default true.
    Required: No
    Default: true
Defined at:
Codex:
Change Log:
  • 5.0.0

Updates sites in cache.



Source

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' );
		wp_cache_add( $site->blog_id . 'short', $site, 'blog-details' );
	}

	if ( $update_meta_cache ) {
		update_sitemeta_cache( $site_ids );
	}
}