Uses
| Uses | Description |
|---|---|
| wp-includes/ms-site.php: update_sitemeta_cache() | Updates metadata cache for list of site IDs. |
| wp-includes/cache.php: wp_cache_add() | Adds data to the cache, if the cache key doesn’t already exist. |
Updates sites in cache.
(array) (Required) Array of site objects.
(bool) (Optional) Whether to update site meta cache.
Default value: true
File: wp-includes/ms-site.php
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 );
}
} | Version | Description |
|---|---|
| 5.1.0 | Introduced the $update_meta_cache parameter. |
| 4.6.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/update_site_cache