_prime_site_caches

Adds any sites from the given ids to the cache that do not already exist in cache.

Description

_prime_site_caches( (array) $ids ); 

Parameters (1)

0. $ids (array)
The ids.

Usage

  1. if ( !function_exists( '_prime_site_caches' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-blogs.php'; 
  3.  
  4. // The ids. 
  5. $ids = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _prime_site_caches($ids); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-blogs.php  
  1. function _prime_site_caches( $ids ) { 
  2. global $wpdb; 
  3.  
  4. $non_cached_ids = _get_non_cached_ids( $ids, 'sites' ); 
  5. if ( ! empty( $non_cached_ids ) ) { 
  6. $fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", join( ", ", array_map( 'intval', $non_cached_ids ) ) ) ); 
  7.  
  8. update_site_cache( $fresh_sites );