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
This commit is contained in:
Sergey Biryukov
2020-12-24 11:19:29 +00:00
parent e78d988aa2
commit 54b6981355
+1 -1
View File
@@ -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;
}
}