Home › Forums › ACF PRO › how to make field taxnonmy for parent category & other field for child category › Reply To: how to make field taxnonmy for parent category & other field for child category
I don’t know of the OP found a solution. This question was asked a long time ago.
I would use select fields and not taxonomy fields. For the first field I would dynamically generate the values of the “parent” category form the information here https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/
For the child category I would use ajax to populate the select field. I have created an example of doing this here https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-select-example. This example uses posts in a post type, but the principle is the same.
You would also need to create an acf/save_post filter https://www.advancedcustomfields.com/resources/acf-save_post/ if you want to update the post categories https://codex.wordpress.org/Function_Reference/wp_set_post_terms since you wouldn’t be using a taxonomy field that would do this automatically.
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!