队列注释元数据延迟加载。
原型
wp_queue_comments_for_comment_meta_lazyload( array $comments )
参数
$comments
(array)
(Required)
注释对象的数组。
源文件
路径:wp-includes/comment.php
<?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 );
}
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_queue_comments_for_comment_meta_lazyload/