update_term_cache()WP 2.3.0

Updates terms in cache.

Хуков нет.

Возвращает

null. Ничего.

Использование

update_term_cache( $terms, $taxonomy );
$terms(WP_Term[]) (обязательный)
Array of term objects to change.
$taxonomy(строка)
Not used.
По умолчанию: ''

Список изменений

С версии 2.3.0 Введена.

Код update_term_cache() WP 6.0.2

function update_term_cache( $terms, $taxonomy = '' ) {
	$data = array();
	foreach ( (array) $terms as $term ) {
		// Create a copy in case the array was passed by reference.
		$_term = clone $term;

		// Object ID should not be cached.
		unset( $_term->object_id );

		$data[ $term->term_id ] = $_term;
	}
	wp_cache_add_multiple( $data, 'terms' );
}