Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Front-end filter logic › Reply To: Front-end filter logic
September 2, 2021 at 8:51 am
#34490
Keymaster
Hi!
To add new values to an existing taxonomy term filter, use this one:
add_filter('asp_pre_get_front_filters', 'asp_change_a_filter', 10, 2);
function asp_change_a_filter($filters, $type) {
foreach ($filters as $k => &$filter) {
if ( $filter->field() == 'product_tag' ) {
$filter->add(array(
'label' => 'My custom product tag',
'selected' => false,
'id' => 123
));
}
}
return $filters;
}
Of course the tag ID needs to be an existing tag ID, the label does not matter.