update_term_cache() - WordPress 函数参考中文文档

返回介绍

update_term_cache()

发布于 2017-09-11 字数1488 浏览 803 评论 0

update_term_cache( array $terms,  string $taxonomy = '' )

Updates Terms to Taxonomy in cache.


描述


参数

$terms

(array)
(Required)
List of term objects to change.

$taxonomy

(string)
(Optional)
Update Term to this taxonomy in cache.

Default value: ”


源代码

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

更新日志

Version 描述
2.3.0 Introduced.

相关函数

Uses

  • wp-includes/cache.php:
    wp_cache_add()

Used By

  • wp-includes/class-wp-term-query.php:
    WP_Term_Query::get_terms()
  • wp-includes/taxonomy.php:
    _prime_term_caches()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!