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

Reply To: Front-end filter logic

#34490
Ernest MarcinkoErnest Marcinko
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.