Support

Account

Home Forums General Issues Creating post with Gravity forms, get_fields($post_ID) are kind of empty. Reply To: Creating post with Gravity forms, get_fields($post_ID) are kind of empty.

  • I’m sure @mvaneijgen moved on long ago but for anyone else wondering about this. Here’s the brute force solution I used to make this work.

    I set a gform action that runs after the form submits.
    add_action( 'gform_after_submission_7', 'asphs_update_post_content', 10, 2 );

    That function maps the custom fields to the acf field keys. (If you look at the database you can see this stuff get generated when you hit update after the failure pattern described in the original post here.).

    So not a great solution but functional. I’d still rather trigger whatever is running on the post update but . . .

    function asphs_update_post_content( $entry, $form ) {
        //getting post
        $post_id = get_post( $entry['post_id'] );
        update_field("_personal_information_first_name","field_5b672aa250437",$post_id);
    	update_field("_personal_information_last_name","field_5b672aa850438",$post_id);
    	update_field("_personal_information_email","field_5b677443f6a3b",$post_id);
    	update_field("_personal_information_phone_number","field_5b672ab050439",$post_id);
    	update_field("_personal_information_university_affiliation","field_5b672ab75043a",$post_id);
    	update_field("_personal_information_private","field_5b672afd156eb",$post_id);
    	update_field("_personal_information_biography","field_5b672adeed779",$post_id);
    	update_field("_personal_information_profile_picture","field_5b672c956690c",$post_id);
    	update_field("_personal_information_expertise","field_5b9871dce76ec",$post_id);
    	update_field("_personal_information","field_5b672a9150436",$post_id);
    	update_field("_location_street_address","field_5b6727dba1a94",$post_id);
    	update_field("_location_city","field_5b6727e5a1a95",$post_id);
    	update_field("_location_state_province","field_5b9daddced8c0",$post_id);
    	update_field("_location_zip_code","field_5b6727eba1a96",$post_id);
    	update_field("_location_country","field_5b6727f5a1a97",$post_id);
    	update_field("_location","field_5b6727c3a1a93",$post_id);
        $i = wp_update_post( $post_id );
    
    }