mirror of
git://develop.git.wordpress.org/
synced 2025-04-08 14:13:27 +02:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@55855 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
52f05444ba
commit
48683a21fe
@ -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 );
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -26,6 +26,8 @@ class Tests_Lazy_Load_Comment_Meta extends WP_UnitTestCase {
|
||||
* @ticket 57901
|
||||
*
|
||||
* @covers ::wp_queue_comments_for_comment_meta_lazyload
|
||||
*
|
||||
* @expectedDeprecated wp_queue_comments_for_comment_meta_lazyload
|
||||
*/
|
||||
public function test_wp_queue_comments_for_comment_meta_lazyload() {
|
||||
$filter = new MockAction();
|
||||
@ -45,6 +47,8 @@ class Tests_Lazy_Load_Comment_Meta extends WP_UnitTestCase {
|
||||
* @ticket 57901
|
||||
*
|
||||
* @covers ::wp_queue_comments_for_comment_meta_lazyload
|
||||
*
|
||||
* @expectedDeprecated wp_queue_comments_for_comment_meta_lazyload
|
||||
*/
|
||||
public function test_wp_queue_comments_for_comment_meta_lazyload_new_comment() {
|
||||
$filter = new MockAction();
|
||||
|
Loading…
x
Reference in New Issue
Block a user