Support

Account

Home Forums Bug Reports acf/save_post – wrong taxonomy field value Reply To: acf/save_post – wrong taxonomy field value

  • As a test I created a field group that has 2 fields.
    The first field is a taxonomy field and named taxonomy
    The second field is a text field and named temp_field
    I then created an acf/save_post filter with the priority set to 20, here is the filter

    
    add_action('acf/save_post', 'test_tax_problem', 20);
    function test_tax_problem($post_id) {
      $tax = get_field('taxonomy', $post_id, false);
      update_post_meta($post_id, 'temp_field', $tax);
    }
    

    What it does is simply get the new value from the taxonomy field after ACF and puts the value into the text field so I can see what value is being returned for the taxonomy field at this point.

    Testing with different options I get these results

    
    Save Terms =  No, Load Terms =  No : returns new terms
    Save Terms =  No, Load Terms = Yes : RETURNS OLD TERMS
    Save Terms = Yes, Load Terms =  No : returns new terms
    Save Terms = Yes, Load Terms = Yes : returns new terms
    

    These are exactly the results I would expect to get. Let me know if you do not understand why.