diff --git a/includes/widgets/class-wc-widget-layered-nav.php b/includes/widgets/class-wc-widget-layered-nav.php index a16a2b0daf8..0bf3583bbc0 100644 --- a/includes/widgets/class-wc-widget-layered-nav.php +++ b/includes/widgets/class-wc-widget-layered-nav.php @@ -374,10 +374,11 @@ class WC_Widget_Layered_Nav extends WC_Widget { // Maybe store a transient of the count values. $cache = apply_filters( 'woocommerce_layered_nav_count_maybe_cache', true ); - if ( true === $cache ) { $cached_counts = (array) get_transient( 'wc_layered_nav_counts_' . $taxonomy ); - } + } else { + $cached_counts = array(); + } if ( ! isset( $cached_counts[ $query_hash ] ) ) { $results = $wpdb->get_results( $query, ARRAY_A ); // @codingStandardsIgnoreLine