Filter: ep_facet_taxonomy_terms

apply_filters( 'ep_facet_taxonomy_terms', $terms, $taxonomy ) → {array}

Filter the taxonomy facet terms.

Example of usage, to hide unavailable category terms:

add_filter(
    'ep_facet_taxonomy_terms',
    function ( $terms, $taxonomy ) {
        if ( 'category' !== $taxonomy ) {
            return $terms;
        }

        return array_filter(
             $terms,
             function ( $term ) {
                 return $term->count > 0;
             }
        );
     },
     10,
     2
);
Parameters:
Name Type Description
$terms array

Terms

$taxonomy string

Taxonomy name

Since:
  • 4.3.1
Source:
Returns:

New terms

Type
array