update_term_cache( WP_Term[] $terms, string $taxonomy = '' )
Updates terms in cache.
Parameters
- $terms
-
(Required) Array of term objects to change.
- $taxonomy
-
(Optional) Not used.
Default value: ''
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' );
}
}
Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |