wp_queue_comments_for_comment_meta_lazyload

Queues comments for metadata lazy-loading.

Description

wp_queue_comments_for_comment_meta_lazyload( (array) $comments ); 

Parameters (1)

0. $comments (array)
Array of comment objects.

Usage

  1. if ( !function_exists( 'wp_queue_comments_for_comment_meta_lazyload' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment.php'; 
  3.  
  4. // Array of comment objects. 
  5. $comments = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_queue_comments_for_comment_meta_lazyload($comments); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/comment.php  
  1. function wp_queue_comments_for_comment_meta_lazyload( $comments ) { 
  2. // Don't use `wp_list_pluck()` to avoid by-reference manipulation. 
  3. $comment_ids = array(); 
  4. if ( is_array( $comments ) ) { 
  5. foreach ( $comments as $comment ) { 
  6. if ( $comment instanceof WP_Comment ) { 
  7. $comment_ids[] = $comment->comment_ID; 
  8.  
  9. if ( $comment_ids ) { 
  10. $lazyloader =wp_metadata_lazyloader); 
  11. $lazyloader->queue_objects( 'comment', $comment_ids );