I’m trying to show a field group based on post category.
If I do this using a location rule, then when editing a new post that has not been assigned the conditional category, I have to add the category, save the post, and refresh the page before the ACF fields show up. This is understandable behaviour but not very user-friendly.
If I add a taxonomy field for the category, and a group field with conditional logic based on the taxonomy field, the behaviour is as desired. Toggling categories in the taxonomy field instantly toggles the group field on-the-fly. However, the problem is that the conditional logic for the taxonomy field does not have an option to set a specific value. Only “has any value”, “has no value”, “selection is greater than”, and “selection is less than”.
What would be the best way to achieve what I want? Pointers to custom PHP/JS code are welcome.
Hi, I don’t see “value is greater/less than” when I nominate a taxonomy field in the conditional logic. Only “selection is greater/less than”, which I had tried, and seemed to refer to the number of options selected rather than the value.
That is not how it appears to be working for me, though. For example selection > 0 and < 2 shows the group field when ANY 1 term is selected. Selection > 2 and < 4 shows the group field when ANY 3 terms are selected. Etc…
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users