Skip Navigation

[Resolved] Views query filter doesn't allow "NOT IN" filters?

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by daveM 7 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#437608
Screen Shot 2016-09-19 at 10.40.51 AM.png

I am trying to add a filter to my View that excludes one category, but the filter UI doesn't include an option to add an 'operator' such as 'NOT IN'. I've seen screenshots in the help docs and other support threads that include filters like this, but maybe it was an old version? Should those options still be there? How would I accomplish this otherwise?

Thank you.

#437840

Dear dave,

You are right, there isn't such an option in taxonomy view.
But you can try with Views filter hook "wpv_filter_taxonomy_query", to add the filter you want:
https://toolset.com/documentation/user-guides/views-filters/wpv_filter_taxonomy_query/
When displaying a View listing taxonomy terms, this filter is applied to the arguments that will be passed to the get_terms() call.

To add the "exclude" parameters:
https://developer.wordpress.org/reference/functions/get_terms/
'exclude'
(array|string) Array or comma/space-separated string of term ids to exclude. If $include is non-empty, $exclude is ignored.

#438053

Hi Luo,

Thanks for your reply! I noticed on the link you sent that that filter is being reworked and will probably change in the near future. Is there any other solution that would work so that this does not break when you guys change this filter? Are there plans to add a "NOT IN" operator to the Views filters anytime soon?

Thanks,
Dave

#438282

Q1) Is there any other solution that would work so that this does not break when you guys change this filter?
No, I don't think there is other better solution, if we change this filter, we will provide you a way to upgrade this filter

Q2) Are there plans to add a "NOT IN" operator to the Views filters anytime soon?
No, there isn't plans for it, if you agree, we can take it as a feature request

#438529

Thanks. I'll take my chances with that filter and see how it goes. Thanks again!

The forum ‘Types Community Support’ is closed to new topics and replies.

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