Need GF to update ACF fields on Custom (Tag) Taxonomy after form submission [RESOLVED]

I have a Custom Post Type: Talk
The CPT has a Custom Taxonomy (tag): Speaker
The Custom Taxonomy has 3 Advanced Custom Fields: Institution, Phone, Email

The form is to “Add a Talk” and properly creates a draft post, and the Speaker. However I can’t seem to sort out how to take the form fields related to the Speaker Inst/Ph/Em and add them to the Speaker that’s created on submission. Below is what I’m working with (which was throwing fatal errors because I was missing a closing parens … but it’s always something … ) and can’t seem to get it working properly. Any insights greatly appreciated.

add_action( 'gform_after_submission_2', 'update_taxonomy_acf', 10, 2 );

function update_taxonomy_acf( $entry, $form ) {

    $post = get_post( $entry['post_id'] );

    $talk_speakers = get_the_terms( $post->ID, 'talk_speaker' ); 

    foreach($talk_speakers as $talk_speaker) {
        update_field( 'speaker_institution', rgar( $entry, '3' ), $talk_speaker->term_id);
        update_field( 'speaker_phone_number', rgar( $entry, '10' ), $talk_speaker->term_id);
        update_field( 'speaker_email_address', rgar( $entry, '11' ), $talk_speaker->term_id);

Alright folks. I have the answer to my own question.
I did end up switching to Advanced Post Creation, so that’s a minor difference. And I got a little more verbose as I was sorting out issues, but the primary issue was the syntax for the ACF update_field() function. Prefix the value of the term_id with the function name of the taxonomy.

I missed that finer point in this doc: ACF | update_field()

add_action( 'gform_advancedpostcreation_post_after_creation_2', 'after_post_creation', 10, 4 );
function after_post_creation( $post_id, $feed, $entry, $form ){
    $spkr_inst = rgar( $entry, '3' );
    $spkr_ph = rgar( $entry, '10' );
    $spkr_em = rgar( $entry, '11' );
    $talk_speakers = get_the_terms( $post_id, 'talk_speaker' );
    foreach($talk_speakers as $talk_speaker) {
        $spkr_id = 'talk_speaker_'.$talk_speaker->term_id;
        update_field( 'speaker_institution', $spkr_inst, $spkr_id);
        update_field( 'speaker_phone_number', $spkr_ph, $spkr_id);
        update_field( 'speaker_email_address', $spkr_em, $spkr_id);

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.