_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
if ( !function_exists( '_prime_network_caches' ) ) { require_once ABSPATH . WPINC . '/ms-blogs.php'; } // Array of network IDs. $network_ids = array(); // NOTICE! Understand what this does before running. $result = _prime_network_caches($network_ids);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/ms-blogs.php
- function _prime_network_caches( $network_ids ) {
- global $wpdb;
- $non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' );
- if ( !empty( $non_cached_ids ) ) {
- $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", join( ", ", array_map( 'intval', $non_cached_ids ) ) ) );
- update_network_cache( $fresh_networks );
- }
- }