Home › Forums › General Issues › Conditional nested relations? › Reply To: Conditional nested relations?
There really isn’t a way to make the field keys dynamic.
You need to have the exact fields that you want to act on. Even when using the ACF JS API you must provide a field key to get a field.
You could potentially localize the script with the field keys needed, but that just transfers the hard coding to the server PHP rather than the JS code.
You could potentially create a site option to define the fields that will be used, but that would make even more work.
If this was something that I would be using many times I would build a plugin and define the fields with PHP so that the field keys would never change.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.