_prime_term_caches( array $term_ids, bool $update_meta_cache = true )
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Adds any terms from the given IDs to the cache that do not already exist in cache.
Parameters
- $term_ids
-
(array) (Required) Array of term IDs.
- $update_meta_cache
-
(bool) (Optional) Whether to update the meta cache.
Default value: true
Source
File: wp-includes/taxonomy.php
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, $update_meta_cache ); if ( $update_meta_cache ) { update_termmeta_cache( $non_cached_ids ); } } }
Changelog
Version | Description |
---|---|
4.6.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_prime_term_caches