^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 5年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云1核2g仅需102元/年,今日10点开抢

wordpress函数clean_object_term_cache()用法示例

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

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈