Skip Navigation

[Résolu] I need to be able to use OR in the query filter for a view

This support ticket is created Il y a 1 mois et 3 semaines. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 1 réponse, has 2 voix.

Last updated by Minesh Il y a 1 mois et 3 semaines.

Assisted by: Minesh.

Auteur
Publications
#2686750
Screenshot 2024-03-06 at 18.13.52.png

I understand that View Query Filters use AND and not OR.

I need to use OR for my my Query Filter and found two work-around pieces of code here:

https://toolset.com/forums/topic/user-view-with-or-in-the-query-filter/
https://toolset.com/errata/and-always-used-with-multiple-views-query-filters-even-if-or-is-specified/

However these workarounds do not work where I have two Query Filters set as follows (as per screenshot):

Filter by post relationship or repeatable fields group owner
Post author filter

i.e. I would like to be able to (Filter by post relationship or repeatable fields group owner) OR (Post author filter)

#2686787

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Normally - You can apply the "AND" or "OR" clause to the entity of same type. For instance, there are multiple custom fields added to filter the view we can define the "AND" or "OR" for those multiple custom field.

You have two different entity here so I will have to check if we can have any workaround here.

Can you please share problem URL where you added your view as well as admin access details. Once I check your structure let me see if I will be able to share any possible workaround.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2686824

Hi Minesh. Thank you. The fact that you can't use OR comparison with different entity types has prompted me to think about my implementation and I think I can work up a better and simpler design.

Gavin confirmed that the issue was resolved on 2024-03-07 10:39:28.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.