Skip to content

Commit

Permalink
Update class-search-stats.php
Browse files Browse the repository at this point in the history
Always queue the remote post count query if the post count is over the local query limit.
  • Loading branch information
oikeme committed Dec 17, 2024
1 parent ed1aad0 commit fb4f12e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit fb4f12e

Please sign in to comment.