WC_Brands::remove_terms_with_empty_products()
Remove terms with empty products.
Method of the class: WC_Brands{}
No Hooks.
Return
WP_Term[]
.
Usage
// private - for code of main (parent) class only $result = $this->remove_terms_with_empty_products( $terms );
- $terms(WP_Term[]) (required)
- The terms array that needs to be removed of empty products.
WC_Brands::remove_terms_with_empty_products() WC Brands::remove terms with empty products code WC 9.5.1
private function remove_terms_with_empty_products( $terms ) { return array_filter( $terms, function ( $term ) { return $term->count > 0; } ); }