From 54b69813556129e36975731358b14c061d7cd96a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 24 Dec 2020 11:19:29 +0000 Subject: [PATCH] Posts, Post Types: Correct the check for term IDs to be queued for lazy-loading term meta. This ensures that the `$term_ids` array in `wp_queue_posts_for_term_meta_lazyload()` (an indexed array not keyed by ID) does not contain duplicate values. Props denishua, akabarikalpesh. Fixes #52144. git-svn-id: https://develop.svn.wordpress.org/trunk@49905 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 9f360e3391..23bfc6d68a 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -7344,7 +7344,7 @@ function wp_queue_posts_for_term_meta_lazyload( $posts ) { $terms = get_object_term_cache( $post->ID, $taxonomy ); if ( false !== $terms ) { foreach ( $terms as $term ) { - if ( ! isset( $term_ids[ $term->term_id ] ) ) { + if ( ! in_array( $term->term_id, $term_ids, true ) ) { $term_ids[] = $term->term_id; } }