update_sitemeta_cache example

$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 );
    }
}

/** * Updates metadata cache for list of site IDs. * * Performs SQL query to retrieve all metadata for the sites matching `$site_ids` and stores them in the cache. * Subsequent calls to `get_site_meta()` will not need to query the database. * * @since 5.1.0 * * @param array $site_ids List of site IDs. * @return array|false An array of metadata on success, false if there is nothing to update. */
Home | Imprint | This part of the site doesn't use cookies.