_prime_term_caches()
Adds any terms from the given IDs to the cache that do not already exist in cache.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
_prime_term_caches( $term_ids, $update_meta_cache );
- $term_ids(массив) (обязательный)
- Array of term IDs.
- $update_meta_cache(true|false)
- Whether to update the meta cache.
По умолчанию: true
Заметки
- Global. wpdb. $wpdb WordPress database abstraction object.
Список изменений
С версии 4.6.0 | Введена. |
С версии 6.1.0 | This function is no longer marked as "private". |
С версии 6.3.0 | Use wp_lazyload_term_meta() for lazy-loading of term meta. |
Код _prime_term_caches() prime term caches WP 6.8
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 ) { wp_lazyload_term_meta( $term_ids ); } }