Can you hide empty terms using get_term_children?
With the get_term_children() function there is nothing to pass which will hide empty terms. You could do that in your foreach as each term has a property which holds how many posts it is assigned: foreach( $style_categories as $style ) { $child = get_term_by( ‘id’, $style, ‘product_cat’ ); // Skip empty terms if( $child->count <= … Read more