woocommerce_change_term_counts
Filter which product taxonomies should have their term counts overridden to take catalog visibility into account.
Usage
add_filter( 'woocommerce_change_term_counts', 'wp_kama_woocommerce_change_term_counts_filter' );
/**
* Function for `woocommerce_change_term_counts` filter-hook.
*
* @param array $valid_taxonomies List of taxonomy slugs.
*
* @return array
*/
function wp_kama_woocommerce_change_term_counts_filter( $valid_taxonomies ){
// filter...
return $valid_taxonomies;
}
- $valid_taxonomies(array)
- List of taxonomy slugs.
Changelog
| Since 2.1.0 | Introduced. |
Where the hook is called
woocommerce_change_term_counts
woocommerce/includes/wc-term-functions.php 586
$valid_taxonomies = apply_filters( 'woocommerce_change_term_counts', array( 'product_cat', 'product_tag', 'product_brand' ) );