From 3c5d179fc9df0ae9ccb5f68f9627111dfa61efb2 Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Thu, 25 May 2023 10:31:23 +0000 Subject: [PATCH] Comments: Deprecate wp_queue_comments_for_comment_meta_lazyload function. As of [55749] wp_queue_comments_for_comment_meta_lazyload is no longer used in core. This commit, deprecates this function. Update docs and tests accordingly. Props sh4lin, spacedmonkey, costdev, peterwilsoncc. Fixes #58301. Built from https://develop.svn.wordpress.org/trunk@55855 git-svn-id: http://core.svn.wordpress.org/trunk@55367 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/deprecated.php | 23 +++++++++++++++++++++++ wp-includes/class-wp-query.php | 2 +- wp-includes/comment.php | 24 ------------------------ wp-includes/version.php | 2 +- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php index 04f7208422..4fa4926040 100644 --- a/wp-admin/includes/deprecated.php +++ b/wp-admin/includes/deprecated.php @@ -1588,3 +1588,26 @@ function image_attachment_fields_to_save( $post, $attachment ) { return $post; } + +/** + * 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 ); +} diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index 38b89601fb..fe0d127b8f 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -4891,7 +4891,7 @@ class WP_Query { * Lazyload comment meta for comments in the loop. * * @since 4.4.0 - * @deprecated 4.5.0 See wp_queue_comments_for_comment_meta_lazyload(). + * @deprecated 4.5.0 See wp_lazyload_comment_meta(). * * @param mixed $check * @param int $comment_id diff --git a/wp-includes/comment.php b/wp-includes/comment.php index b6f5420577..5d87da2890 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -525,30 +525,6 @@ function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value = return update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value ); } -/** - * Queues comments for metadata lazy-loading. - * - * @since 4.5.0 - * @since 6.3.0 Use wp_lazyload_comment_meta() for lazy-loading of comment meta. - * - * @see wp_lazyload_comment_meta() - * - * @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; - } - } - } - - wp_lazyload_comment_meta( $comment_ids ); -} - /** * Sets the cookies used to store an unauthenticated commentator's identity. Typically used * to recall previous comments by this commentator that are still held in moderation. diff --git a/wp-includes/version.php b/wp-includes/version.php index 26f068a89c..7486bb8aea 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55854'; +$wp_version = '6.3-alpha-55855'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.