wp_lazyload_comment_meta( array $comment_ids )
Queue comment meta for lazy-loading.
Parameters
-
$comment_ids
array Required -
List of comment IDs.
Source
File: wp-includes/comment.php
.
View all references
function wp_lazyload_comment_meta( array $comment_ids ) {
if ( empty( $comment_ids ) ) {
return;
}
$lazyloader = wp_metadata_lazyloader();
$lazyloader->queue_objects( 'comment', $comment_ids );
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
In this example, the
wp_lazyload_comment_meta
function takes an array of comment IDs and iterates through them. For each comment ID, it simulates lazyloading by fetching comment metadata using theget_comment_meta
function. The metadata is then processed, and in this case, it’s simply printed to the screen. You can replace the print statements with your desired processing logic. The example usage at the end demonstrates how to call the function with an array of comment IDs.