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.
Built from https://develop.svn.wordpress.org/trunk@49905


git-svn-id: http://core.svn.wordpress.org/trunk@49604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-12-24 11:21:04 +00:00
parent c81db1f6e6
commit 5a7fa8b7f3
2 changed files with 2 additions and 2 deletions

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;
}
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-alpha-49904';
$wp_version = '5.7-alpha-49905';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.