wordpress / latest / functions / update_term_cache.html

update_term_cache( WP_Term[] $terms, string $taxonomy = '' )

Updates terms in cache.

Parameters

$terms WP_Term[] Required
Array of term objects to change.
$taxonomy string Optional
Not used.

Default: ''

Source

File: wp-includes/taxonomy.php. View all references

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' );
}

Uses

Uses Description

Used By

Used By Description

Changelog

Version Description
2.3.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/update_term_cache