функция
since 5.1.0
update_site_cache()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
update_site_cache( array $sites, bool $update_meta_cache = true )
Описание
Обновляет сайты в кэше.
Параметры
$sites
array
обязательный
Массив объектов сайтов.
$update_meta_cache
bool
необязательный
= true
Обновлять ли кэш метаданных сайта.
Исходный код
wp-includes/ms-site.php:392
function update_site_cache( $sites, $update_meta_cache = true ) {
if ( ! $sites ) {
return;
}
$site_ids = array();
$site_data = array();
$blog_details_data = array();
foreach ( $sites as $site ) {
$site_ids[] = $site->blog_id;
$site_data[ $site->blog_id ] = $site;
$blog_details_data[ $site->blog_id . 'short' ] = $site;
}
wp_cache_add_multiple( $site_data, 'sites' );
wp_cache_add_multiple( $blog_details_data, 'blog-details' );
if ( $update_meta_cache ) {
update_sitemeta_cache( $site_ids );
}
}
История изменений
| Версия | Описание |
|---|---|
| 5.1.0 | Introduced the $update_meta_cache parameter. |
| 4.6.0 | Introduced. |

