Forums › Forums › Search & Filter Pro › dependent taxonomies
- This topic has 3 replies, 2 voices, and was last updated 4 years, 9 months ago by
Trevor.
-
Anonymous(Private) July 22, 2020 at 10:36 pm #253613
Hello,
I’m a developer trying to use Search & Filter Pro to handle something WordPress doesn’t offer: dependent (or primary/secondary) taxonomies.
For example:
- Taxonomy A
- Term 1
- Term 2
- Term 3
- Taxonomy B
- Term 4
- Term 5
- Term 6
Taxonomy B is related to Taxonomy A : Term 2 but is different enough that using a hierarchical structure doesn’t make sense.
I’ve managed to conditionally hide the form field Taxonomy B using the
sf_display_field
filter.The problem is when a Taxonomy B term is selected and the Taxonomy A term is changed to one without dependents, the dependent term remains in the URL which returns no results.
For example, using the post type archive option:
/tax-a/term-2/?_sft_tax_b=5
= works greatIf the user then selects a different primary term:
/tax-a/term-1/?_sft_tax_b=5
= nothing foundAny suggestions?
Thanks,
ChrisAnonymous(Private) July 23, 2020 at 7:03 pm #253700Thanks for the quick reply, Trevor.
Unfortunately, the site is not live yet. I solved my problem by adding some conditional redirects to the
init
hook which act like rewrite rules.I was hoping to apply the logic via filters but the plugin does not seem to offer suitable ones nor does it seem to modify the tax or meta queries, at least as far as I can tell. I started digging into the code but got lost in the cache mechanism. 🙂
Overall, it’s a good plugin that got me 95% there.
Cheers,
Chris - Taxonomy A
-
AuthorPosts