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

返回介绍

clean_object_term_cache()

发布于 2017-09-10 字数2377 浏览 972 评论 0

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

Removes the taxonomy relationship to terms from the cache.


描述

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

更新日志

Version 描述
2.3.0 Introduced.

相关函数

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

上一篇:clean_network_cache()

下一篇:clean_page_cache()

发布评论

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

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