wpseek.com
A WordPress-centric search engine for devs and theme authors



update_term_cache › WordPress Function

Since2.3.0
Deprecatedn/a
update_term_cache ( $terms, $taxonomy = '' )
Parameters: (2)
  • (WP_Term[]) $terms Array of term objects to change.
    Required: Yes
  • (string) $taxonomy Not used.
    Required: No
    Default: (empty)
Defined at:
Codex:

Updates terms in cache.



Source

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