update_post_author_caches

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

update_post_author_caches: 这个函数更新一个文章的作者的缓存。它需要一个参数:$post_id。$post_id是需要更新作者缓存的文章的ID。

为文章对象的列表更新文章作者用户缓存。

function update_post_author_caches( $posts ) {
	$author_ids = wp_list_pluck( $posts, 'post_author' );
	$author_ids = array_map( 'absint', $author_ids );
	$author_ids = array_unique( array_filter( $author_ids ) );

	cache_users( $author_ids );
}

常见问题

FAQs
查看更多 >
闪电侠

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

2025-12-14 15:36:34

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

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

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