Home Forums ACF PRO Dynamically fill a taxonomy field Reply To: Dynamically fill a taxonomy field

  • That is a very old example and what you are seeing is why I used select fields instead of ACF Post Object, Relationship or Taxonomy fields in that example. The only reason I created that repo was to post examples from work that I’ve actually done for clients.

    Since I built that ACF has added the select2_ajax_data filter hook to the JS API. This filter can be used to get the value selected in another field and pass it to the server in ACF’s AJAX request used to populate the fields I mentioned above. You can then get that value from $_POST in one of the ACF server side query filters (acf/fields/relationship/query, acf/fields/post_object/query, acf/fields/taxonomy/query, acf/fields/taxonomy/wp_list_categories) to modify what is shown by ACF.

    Unfortunately, I don’t have any examples of this because I have not found a reason to build them and would not rebuild old code unless it stops working.