返回介绍

clean_object_term_cache()

发布于 2017-09-10 21:42:51 字数 2378 浏览 1094 评论 0 收藏 0

clean_object_term_cache( int|array $object_ids,  array|string $object_type )

Removes the taxonomy relationship to terms from the cache.


description

Will remove the entire taxonomy relationship containing term $object_id. The term IDs have to exist within the taxonomy $object_type for the deletion to take place.


参数

$object_ids

(int|array) (Required) Single or list of term object ID(s).

$object_type

(array|string) (Required) The taxonomy object type.


源代码

File: wp-includes/taxonomy.php

function clean_object_term_cache($object_ids, $object_type) {
	global $_wp_suspend_cache_invalidation;

	if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
		return;
	}

	if ( !is_array($object_ids) )
		$object_ids = array($object_ids);

	$taxonomies = get_object_taxonomies( $object_type );

	foreach ( $object_ids as $id ) {
		foreach ( $taxonomies as $taxonomy ) {
			wp_cache_delete($id, "{$taxonomy}_relationships");
		}
	}

	/**
	 * Fires after the object term cache has been cleaned.
	 *
	 * @since 2.5.0
	 *
	 * @param array  $object_ids An array of object IDs.
	 * @param string $object_type Object type.
	 */
	do_action( 'clean_object_term_cache', $object_ids, $object_type );
}

更新日志

Versiondescription
2.3.0Introduced.

相关函数

Uses

  • wp-includes/cache.php: wp_cache_delete()
  • wp-includes/taxonomy.php: clean_object_term_cache
  • wp-includes/taxonomy.php: get_object_taxonomies()
  • wp-includes/plugin.php: do_action()

Used By

  • wp-includes/taxonomy.php: wp_delete_term()
  • wp-includes/post.php: clean_post_cache()
  • wp-includes/post.php: clean_attachment_cache()
  • wp-includes/bookmark.php: clean_bookmark_cache()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文