From fb4f12ea32ac472d8c6cb8d3d3223cf8b41d98bf Mon Sep 17 00:00:00 2001 From: Oli I Date: Tue, 17 Dec 2024 16:56:21 -0600 Subject: [PATCH] Update class-search-stats.php Always queue the remote post count query if the post count is over the local query limit. --- .../packages/my-jetpack/src/products/class-search-stats.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/packages/my-jetpack/src/products/class-search-stats.php b/projects/packages/my-jetpack/src/products/class-search-stats.php index 5857211f0afa0..b64e7c8bd3782 100644 --- a/projects/packages/my-jetpack/src/products/class-search-stats.php +++ b/projects/packages/my-jetpack/src/products/class-search-stats.php @@ -168,13 +168,13 @@ protected static function get_raw_post_type_breakdown() { // Get post type breakdown from a remote request if the post count is high if ( $total_posts_count > self::POST_COUNT_QUERY_LIMIT ) { $search_stats = new Search_Stats(); - $wpcom_stats = json_decode( wp_remote_retrieve_body( $search_stats->get_stats_from_wpcom() ), true ); + $search_stats->queue_post_count_query_from_wpcom(); + $wpcom_stats = json_decode( wp_remote_retrieve_body( $search_stats->get_stats_from_wpcom() ), true ); if ( ! empty( $wpcom_stats['raw_post_type_breakdown'] ) ) { $results = $wpcom_stats['raw_post_type_breakdown']; wp_cache_set( self::POST_TYPE_BREAKDOWN_CACHE_KEY, $results, self::CACHE_GROUP, self::CACHE_EXPIRY ); return $results; } else { - $search_stats->queue_post_count_query_from_wpcom(); return array(); } }