_prime_term_caches() – Adds any terms from the given IDs to the cache that do not already exist in cache.

You appear to be a bot. Output may be restricted

Description

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

Usage

_prime_term_caches( $term_ids, $update_meta_cache );

Parameters

$term_ids
( array ) required – Array of term IDs.
$update_meta_cache
( bool ) optional default: 1 – Optional. Whether to update the meta cache. Default true.

Returns

void

Source

File name: wordpress/wp-includes/taxonomy.php


Lines:

1 to 15 of 15
function _prime_term_caches( $term_ids, $update_meta_cache = true ) {
  global $wpdb;

  $non_cached_ids = _get_non_cached_ids( $term_ids, 'terms' );
  if ( ! empty( $non_cached_ids ) ) {
    $fresh_terms = $wpdb->get_results( sprintf( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) );

    update_term_cache( $fresh_terms );

    if ( $update_meta_cache ) {
      update_termmeta_cache( $non_cached_ids );
    }
  }
}
 

 View on GitHub View on Trac