Skip Navigation

[Resolved] Multiple select meets with "either" condition, not *both*

This support ticket is created 5 years, 1 month ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 5 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1356641

I am trying to:
Use my multiple select "borough" to be *additive*, meaning if *either* condition is met, either than *both*

Link to a page where the issue can be seen:
battstaging.com

I expected to see:
Is this possible?

Instead, I got:
Thanks!

#1356857

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2019-10-07 at 11.21.07.png
Screenshot 2019-10-07 at 11.19.29.png

Hi there

The UI lets you specify whether either term is set when inserting a taxonomy filter, but you don't have the same option when inserting a multiselect fiter for a custom field (compare the screenshots).

The 'IN' comparison is what's required, and although it is missing from the UI for custom field filters it is available as a comparison option for meta queries (https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters).

Which means you can insert a filter with some other comparison, and then use the wpv_filter_query API hook to modify the query to replace the chosen comparison with 'IN'.

See https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query