Support

Account

Home Forums General Issues Issue with update_field Reply To: Issue with update_field

  • Looking at your original code, see my comments in the code

    
    $field_key = "average_review_score";
    $value = "8";
    $post_id = "3";
    
    $get_av = get_field( "average_review_score", $post_id );
    echo $get_av;
    
    // this is updating the post with an ID of 3
    // it is not updating a term in a taxonomy
    update_field( $field_key, $value, $post_id );
    

    If your intent is to update a field that is attached to a term in a taxonomy then you need to use a $post_id that represents that term. See “Getting values from other places” on this page https://www.advancedcustomfields.com/resources/get_field/