Support

Account

Home Forums Backend Issues (wp-admin) How to display dynamicly ACF Fields on change Taxonomy in post-edit ? Reply To: How to display dynamicly ACF Fields on change Taxonomy in post-edit ?

  • the problem is that you are looking at the actual term currently set for the post that is stored by WP.

    
     $main_post_cat = noir_get_team_term($options['post_id'], "team_category", 'slug'); 
    

    You need to look at this, but you also need to check to see if ACF has included the currently selected therm in the $options that it is passing to the filter. This is actually more important then testing the posts current terms, but you need to do both, first checking the $options and if it is not set or it is empty then checking against the post’s current terms.

    If nothing has changed since the last time I created a custom location rule then the terms selected will be in $options['taxonomy']

    One of my old examples shows this https://github.com/Hube2/acf-filters-and-functions/blob/master/acf-post-category-ancestor-location-rule.php