This support ticket is created Il y a 6 années et 10 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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
I am trying to: add Single line custom field filter using checkbox
Link to a page where the issue can be seen:lien caché click on filters
I expected to see: for example, if i click on "Amsterdam" then it will give perfect results, but when I click "Bussum" with "Amsterdam" selected it says no results found.It should give results from "Amsterdam" and "Bussum" as it is checkbox filter.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Hi Marc
Sorry, I misunderstood how you have this set up.
You have a single line text field, which you are displaying as checkboxes in the filter.
The resulting query uses and AND comparison when multiple values are checked, and in this case there is no option to change that.
To make this an OR comparison you would need to use the wpv_filter_query filter and hook into this View and manually override the relation argument of the meta_query to "OR".
If you don't want to add code to your site, make a field type that is a checkboxes field (or use a taxonomy which makes for more efficient queries when used as filters in any case) and then it will function as required.
To make this an OR comparison you would need to use the wpv_filter_query filter and hook into this View and manually override the relation argument of the meta_query to "OR".
Comment : Will it work for the view I have shown you? As it is single line field.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Yes.
If you turn on debug mode for Views (Toolset > Settings > Front-end Content) and reload the page with two of the options selected you will see in the wpv_filter_query section the meta_query used by Views to retrieve the posts, and the relation will be set to AND.
I tried with meta_query "OR" relation using below code. But it was not working properly then I played with the filter settings itself and fount solution.