_prime_network_caches

Adds any networks from the given IDs to the cache that do not already exist in cache.

Description

_prime_network_caches( (array) $network_ids ); 

Parameters (1)

0. $network_ids (array)
Array of network IDs.

Usage

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

Defined (1)

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

/wp-includes/ms-blogs.php  
  1. function _prime_network_caches( $network_ids ) { 
  2. global $wpdb; 
  3.  
  4. $non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' ); 
  5. if ( !empty( $non_cached_ids ) ) { 
  6. $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", join( ", ", array_map( 'intval', $non_cached_ids ) ) ) ); 
  7.  
  8. update_network_cache( $fresh_networks );