Home › Forums › Front-end Issues › Change value when regsitering field via php based upon taxonomy selected › Reply To: Change value when regsitering field via php based upon taxonomy selected
Hi Greenhoe,
I don’t think you can easily update the taxonomy parameter of your field once the edit screen has been rendered. It would require an AJAX call and recreating the entire field dynamically..
May I suggest a different solution that’s maybe a bit easier and doable.
If you use a relationship field instead there’s a built in filter capability for taxonomies. You can set the field to only allow for 1 value so that it’ll work pretty much the same as the post_object field.
Then if you really want you should be able to create some custom Javascript for the extra functionality. Look for a change in the taxonomy dropdown and change the taxonomy filter dropdown in the relationship field accordingly. It should trigger the filtering automatically. If you also want to make sure the client can’t change the filter themselves you could just add a tiny CSS snippet to hide the taxonomy filter from them.
What do you think?
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.