update_post_parent_caches

函数
update_post_parent_caches ( $posts )
参数
  • (WP_Post[]) $posts Array of post objects.
    Required:
定义位置
相关方法
update_post_cachesupdate_post_author_cachesupdate_postmeta_cacheupdate_post_cacheupdate_page_cache
引入
6.1.0
弃用
-

update_post_parent_caches: 这个函数更新一个文章的父级缓存。它需要一个参数:$post_id。$post_id是需要更新父缓存的文章的ID。

更新一个文章对象列表的父文章缓存。

function update_post_parent_caches( $posts ) {
	$parent_ids = wp_list_pluck( $posts, 'post_parent' );
	$parent_ids = array_map( 'absint', $parent_ids );
	$parent_ids = array_unique( array_filter( $parent_ids ) );

	if ( ! empty( $parent_ids ) ) {
		_prime_post_caches( $parent_ids, false );
	}
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 17:32:57

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: