Home › Forums › Feature Requests › Allow for conditional on more fields in php
I have a site that requires some pretty custom dynamic field values. I have a page that needs to show posts from a specific category (with filters added for meta values like “featured post”). I want the user to select a category using the built in taxonomy field type. Then I want to prepopulate a repeater that has a single select box that shows featured posts from the category they chose. Currently, conditional logic only allows for conditions on select, radio, checkbox fields. So, I had to register the field in php as a select and prepopulate the first “category” select using a get_terms call instead of the built in taxonomy field (which is prettier). That way I could use the conditional logic to show a field group based on that choice.
I would like to request that you extend the conditional logic to other field types. That way, when I use php to register those field groups, I can be more dynamic in my creation of field groups. I think this functionality extends to tons of other possible scenarios (especially flexible content fields) and would be useful in far more cases than just my current one.
I will create a feature request for extending the conditional logic to other fields in the Github repo. I don’t think it’s as easy of fix as one would want as it probably requires some special event targeting depending on what field type it is etc. So it might not come in a closer update.
That’s a nice solution tho for the time being. Very creative 🙂
So a bit of update. Elliot thought it was a good idea and actually not that hard to implement so you might get to see this in a near future update 🙂
I would also like to see this option available!
I’ve needed this as well, so I created a custom field setting which allows for conditional logic based on taxonomy. Give it a try when you get a chance.
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
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.