update_termmeta_cache

Updates metadata cache for list of term IDs.

Description

(array|false) update_termmeta_cache( (array) $term_ids ); 

Performs SQL query to retrieve all metadata for the terms matching $term_ids and stores them in the cache. Subsequent calls to get_term_meta() will not need to query the database.

Returns (array|false)

Returns false if there is nothing to update. Returns an array of metadata on success.

Parameters (1)

0. $term_ids (array)
List of term IDs.

Usage

  1. if ( !function_exists( 'update_termmeta_cache' ) ) { 
  2. require_once ABSPATH . WPINC . '/taxonomy.php'; 
  3.  
  4. // List of term IDs. 
  5. $term_ids = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = update_termmeta_cache($term_ids); 
  9.  

Defined (1)

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

/wp-includes/taxonomy.php  
  1. function update_termmeta_cache( $term_ids ) { 
  2. // Bail if term meta table is not installed. 
  3. if ( get_option( 'db_version' ) < 34370 ) { 
  4. return; 
  5.  
  6. return update_meta_cache( 'term', $term_ids );