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

返回介绍

wp_queue_comments_for_comment_meta_lazyload()

发布于 2017-09-11 字数 1515 浏览 944 评论 0

wp_queue_comments_for_comment_meta_lazyload( array $comments )

Queues comments for metadata lazy-loading.


描述


参数

$comments

(array)
(Required)
Array of comment objects.


源代码

File: wp-includes/comment.php

function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
	// Don't use `wp_list_pluck()` to avoid by-reference manipulation.
	$comment_ids = array();
	if ( is_array( $comments ) ) {
		foreach ( $comments as $comment ) {
			if ( $comment instanceof WP_Comment ) {
				$comment_ids[] = $comment->comment_ID;
			}
		}
	}

	if ( $comment_ids ) {
		$lazyloader = wp_metadata_lazyloader();
		$lazyloader->queue_objects( 'comment', $comment_ids );
	}
}

更新日志

Version 描述
4.5.0 Introduced.

相关函数

Uses

  • wp-includes/meta.php:
    wp_metadata_lazyloader()

Used By

  • wp-includes/class-wp-query.php:
    WP_Query::get_posts()
  • wp-includes/comment-template.php:
    wp_list_comments()

User Contributed Notes

发布评论

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

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