wp_queue_comments_for_comment_meta_lazyload() WordPress Function

The wp_queue_comments_for_comment_meta_lazyload() function is used to queue comments for comment meta lazy loading. This function is used internally by the WordPress comment system.

wp_queue_comments_for_comment_meta_lazyload( WP_Comment[] $comments ) #

Queues comments for metadata lazy-loading.


Parameters

$comments

(WP_Comment[])(Required)Array of comment objects.


Top ↑

Source

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


Top ↑

Changelog

Changelog
VersionDescription
4.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More