diff --git a/includes/wc-term-functions.php b/includes/wc-term-functions.php index 8f32b1a7aa8..93a1fa5de70 100644 --- a/includes/wc-term-functions.php +++ b/includes/wc-term-functions.php @@ -516,6 +516,9 @@ function woocommerce_change_term_counts( $terms, $taxonomies, $args ) { if ( is_admin() || is_ajax() ) return $terms; + if ( ! isset( $taxonomies[0] ) || ! is_array( $taxonomies[0] ) ) + return $terms; + if ( ! in_array( $taxonomies[0], apply_filters( 'woocommerce_change_term_counts', array( 'product_cat', 'product_tag' ) ) ) ) return $terms;