wp_queue_comments_for_comment_meta_lazyload

The timeline below displays how wordpress function wp_queue_comments_for_comment_meta_lazyload has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Queues comments for metadata lazy-loading.
 *
 * @since 4.5.0
 * @deprecated 6.3.0 Use wp_lazyload_comment_meta() instead.
 *
 * @param WP_Comment[] $comments Array of comment objects.
 */
function wp_queue_comments_for_comment_meta_lazyload($comments)
{
    _deprecated_function(__FUNCTION__, '6.3.0', 'wp_lazyload_comment_meta()');
    // 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;
            }
        }
    }
    wp_lazyload_comment_meta($comment_ids);
}

WordPress Version: 5.1

/**
 * Queues comments for metadata lazy-loading.
 *
 * @since 4.5.0
 *
 * @param WP_Comment[] $comments Array of comment objects.
 */
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);
    }
}

WordPress Version: 4.5

/**
 * Queues comments for metadata lazy-loading.
 *
 * @since 4.5.0
 *
 * @param array $comments Array of comment objects.
 */
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);
    }
}