Skip Navigation

[Résolu] Exclude some taxonomy terms from filter search….

This support ticket is created Il y a 9 années et 9 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 réponses, has 3 voix.

Last updated by tylerG Il y a 9 années et 9 mois.

Assisted by: Luo Yang.



We have a search form with multiple filter...

We want to exclude some terms from the search result...


- Honda
- Toyota
- Hyundai
- Kia

Si we search in taxonomy CARS but we want to exclude Toyota and Hyundai

In image attached it's the wpv-mobilier taxonomy that we want to exclude some terms

Is it possible to do?



Hi Jean,

Please try Views filter hook wpv_filter_query, like this:
Add codes in your theme/functions.php:

add_filter( 'wpv_filter_query', 'exclude_terms_func', 10, 3 );
function exclude_terms_func($query, $setting, $views_ID)
	if($views_ID == 123)
		$query['tax_query'][] = array(
			'taxonomy' => 'mobilier',
			'field' => 'slug',
			'terms' => array( 'toyota', 'hyundai' ),
			'operator' => 'NOT IN'
		$query['tax_query']['relation'] = 'AND';
	return $query;

Please replace 123 with your views post ID, replace "mobilier" with your custom taxonomy slug

More help:


Wow, that's working.



This is great! I was able to change the Operator to "In" to only include specific terms. The best thing about this snippet is that I can still use the Query Filter option for the parametric search. Thanks!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.