This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Hide Empty Categories

#26352
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

It is possible, but only via using a custom code at the moment. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_filter( 'asp_fontend_get_taxonomy_terms', 'asp_filter_empty_terms', 10, 3 );
function asp_filter_empty_terms($terms, $taxonomy, $args) {
  if ( $taxonomy == 'category' ) {
    return get_terms($taxonomy, array(
      'orderby' => $args['orderby'], 
      'order' => $args['order'],
      'taxonomy'=> $taxonomy,
      'hide_empty' => 1  
    ));
  }  
  return $terms;
}