function update_term_cache( $terms, $taxonomy = '' ) {
foreach ( (array) $terms as $term ) {
// Create a copy in case the array was passed by reference.
- $_term = $term;
+ $_term = clone $term;
// Object ID should not be cached.
unset( $_term->object_id );