WordPress开发者和主题制作者的搜索引擎



update_term_cache ›

Since2.3.0
已弃用n/a
update_term_cache ( $terms, $taxonomy = '' )
参数: (2)
  • (array) $terms List of term objects to change.
    Required: Yes
  • (string) $taxonomy Optional. Update Term to this taxonomy in cache. Default empty.
    Required: No
    默认: (empty)
定义在:
文档:

Updates Terms to Taxonomy in cache.



源码

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