Skip Navigation

[Résolu] Filter by a taxonomy term custom field

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
Exclude taxonomy terms (categories) and posts from View.

Solution:
You can exclude taxonomy terms and posts using wpv_filter_query hook, the code and method is given here:
https://toolset.com/forums/topic/exclude-some-taxonomy-terms-from-filter-search/#post-204079

This support ticket is created Il y a 6 années et 9 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.

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
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Marqué : ,

This topic contains 2 réponses, has 2 voix.

Last updated by Kirill Il y a 6 années et 9 mois.

Assisted by: Noman.

Auteur
Publications
#537102

I have 'Producer' a custom taxonomy and a view that displays goods. This view has a dynamic AJAX filter that allow to filter goods by a certain producer. However, I need to be able to eliminate goods of certain producers from being shown in this catalog.

Let's say I have producers A, B, C, D, and E. I want to eliminate producers B and D, so the users will see only goods of producers A, C, and E when they select 'All producers' in a catalog filter. Users also should see only producers A, C, and E listed in a 'Producers' filter drop-down.

What is the best way to achieve this? I thought of using a custom filed within a taxonomy term, so some taxonomy terms (i.e. some producers) be marked as 'Hidden from catalog'. Then I can show only those terms (producers) that do not have this 'Hidden from catalog' option on. However, Views does not allow me to do that: there is no option to filter by a taxonomy term custom field. Is this not possible currently? What would be the best way to achieve what I need?

Thank you in advance!

Best regards,
Kir

#537147

Noman
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Kirill,

Thank you for contacting Toolset Support. You can exclude taxonomy terms and posts using wpv_filter_query hook, the code and method is given here:
https://toolset.com/forums/topic/exclude-some-taxonomy-terms-from-filter-search/#post-204079

Thank you

#537768

This solves my problem. Very cool! Thank you very much.

But please, if you might, consider adding filter by a taxonomy custom fields to Views somewhen in the future. That would be a very valuable addition!

Thanks!

Kir

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