diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php index 4447b1169b..9a481b1bda 100644 --- a/src/wp-includes/class-wp-comment-query.php +++ b/src/wp-includes/class-wp-comment-query.php @@ -1036,13 +1036,19 @@ protected function fill_descendants( $comments ) { $child_ids = array(); $uncached_parent_ids = array(); $_parent_ids = $levels[ $level ]; - foreach ( $_parent_ids as $parent_id ) { - $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed"; - $parent_child_ids = wp_cache_get( $cache_key, 'comment' ); - if ( false !== $parent_child_ids ) { - $child_ids = array_merge( $child_ids, $parent_child_ids ); - } else { - $uncached_parent_ids[] = $parent_id; + if ( $_parent_ids ) { + $cache_keys = array(); + foreach ( $_parent_ids as $parent_id ) { + $cache_keys[ $parent_id ] = "get_comment_child_ids:$parent_id:$key:$last_changed"; + } + $cache_data = wp_cache_get_multiple( array_values( $cache_keys ), 'comment-queries' ); + foreach ( $_parent_ids as $parent_id ) { + $parent_child_ids = $cache_data[ $cache_keys[ $parent_id ] ]; + if ( false !== $parent_child_ids ) { + $child_ids = array_merge( $child_ids, $parent_child_ids ); + } else { + $uncached_parent_ids[] = $parent_id; + } } }