Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Hide Empty Categories › Reply To: Hide Empty Categories
March 23, 2020 at 1:52 pm
#26352
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;
}