Skip Navigation

[Resolved] No multiple filters for select fields ?

This thread is resolved. Here is a description of the problem and solution.

Problem:

I cannot add a filter like "field is a number equal to 1 or 2".

Solution:

You can switch to "in" comparison.

Relevant Documentation:

https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/

This support ticket is created 4 years, 6 months 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
- 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 4 replies, has 2 voices.

Last updated by nicolaS-3 4 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1604605

Hi,
I have a select field with values 1,2 and 3. When I use that field in filters I can set a single filter only, the "Add another value" button doesn't appear so I cannot add a filter like "field is a number equal to 1 or 2". Why so ?
Thanks Regards
Nicola

#1605197

Hello,

I assume we are talking about custom search form, you are going to setup a multiple select input for custom select field.

If it is, it is possible, for example, your custom select field is using slug "test-se1", you can edit the post view, and try these:
1) In section "Search and Pagination", setup the multiple select input like this:
[wpv-control-postmeta type="multi-select" field="wpcf-test-se1" url_param="wpv-wpcf-test-se1"]

2) In section "Query Filter", setup the filter as below:
Select items with field:
test se1 is a string in URL_PARAM(wpv-wpcf-test-se1)

Please replace "test-se1" with your custom select field slug, and test again.

More help:
https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/
https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-control-postmeta

#1605259
zzz.png

Hello Luo Yang,
much simpler than that. I am just filtering posts in a view, no custom search form (see picture). I have a NEWS CPT and I created a Target field with 3 values: 1=Users, 2=Companies, 3= All. I just want to show in one view news for 1 and 3 and in another view news for 2 and 3. I was expecting that the "Add another value" button was available.....
Thanks
Regards
Nicola

#1605275

Dear Nicola,

In this case, you can switch to "in" comparison, just like your screenshot:
https://toolset.com/wp-content/uploads/2020/04/1605259-zzz.png
under "YOUR EXAMPLE".

It should be able to work as you request: field is a number equal to 1 or 2.
See the document I mentioned above:
https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/
IN
A list of values
Checks if the custom field value is within the list of compare values

#1605287

My issue is resolved now. Thank you!