Support Forum
Support › Meta Box Conditional Logic › Show/Hide Field Group based on Taxonomy when Taxonomy is not in editor
I have a CPT with a taxonomy that is intended to be either/or "group" or "solo". To assist with this, I made a custom field for the CPT to choose taxonomy with a radio button. I turned the taxonomy off for the editor so it would not appear (thereby avoiding the situation where the user could choose both terms). However, another field group that is set to appear only when the CPT is attributed with the term "solo" the field group is not showing up. The radio button does, in fact, affect the taxonomy. How can I achieve this?
https://jam.dev/c/10ed5785-b79d-475b-8891-906e213dd9e9
Addition: I have found that the show/hide ONLY works when the taxonomy is hierarchical AND appears in the editor. I'm also seeing a field group that will not appear even though it meets the condition. I have no idea why. Hoping this is helpful.
https://jam.dev/c/ac8c786d-ad62-46f2-ab9c-1dbc09d3da2a
To avoid ambiguity, I'm asking if anyone can suggest how I can exclude the taxonomy from the editor such that I can force the either/or choice of the necessary terms: either "solo" or "group" AND maintain the conditional appearance of other field groups.
Hello Keith,
You should use the Conditional Logic option in the Settings tab of the field group to set the field group show/hide based on a field value. Screenshot https://monosnap.com/file/Hx63fMcezrUbbOo14iJ5uSOe2SSI19
where 123 is the term ID.
Hi Peter,
I tried that, and didn't see the results I was expecting.
https://jam.dev/c/1e0e79ba-e20b-4fcb-858c-601bfc8306c5
I also tried again, using a different select field (non taxonomy related field options), and then a conditional field works.
https://jam.dev/c/03f4dfa1-36a4-4528-af7f-9908020c33a5
So it seems as though something about the input related to taxonomy isn't working with conditional fields. The toggle or location rules do work...but then there isn't a condition, per ce. Again, I'm trying to make sure the user doesn't select both terms, only one. The display will be dependent on this choice as well.
Let me know if I'm missing something or making some other erroneous assumption. Thank you!
Hello,
As I said above, you should assign the term ID to the condition value, not "Solo". You can get the term ID in the URL when editing it.
Screenshot https://imgur.com/mm7LSSI