update_term_cache( array $terms, string $taxonomy = '' )

Updates Terms to Taxonomy in cache.


Description Description


Parameters Parameters

$terms

(array) (Required) List of term objects to change.

$taxonomy

(string) (Optional) Update Term to this taxonomy in cache.

Default value: ''


Top ↑

Source Source

File: wp-includes/taxonomy.php

function update_term_cache( $terms, $taxonomy = '' ) {
	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 );

		wp_cache_add( $term->term_id, $_term, 'terms' );
	}
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.