wp_queue_comments_for_comment_meta_lazyload()WP 4.5.0

Queues comments for metadata lazy-loading.

Хуков нет.

Возвращает

null. Ничего.

Использование

wp_queue_comments_for_comment_meta_lazyload( $comments );
$comments(WP_Comment[]) (обязательный)
Array of comment objects.

Список изменений

С версии 4.5.0 Введена.

Код wp_queue_comments_for_comment_meta_lazyload() WP 6.2.2

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