Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]

My situation to tackle this problem was a bit problematic because I wanted to use the GF Update Post plugin to let my users edit their post right after they submitted the content. With the above solution ACF does not write to the db and correct ACF fields (at least not for me).

My solution:

  1. Create a ACF custom field group and add a field with the same checkboxes and use the same meta_key as your gravity form.

  2. Use a function after submission to fetch the all matching keys as array and update the ACF field key (Show on screen -> ACF field value in ACF field group edit screen)

    add_action("gform_after_submission_YOUR_FORM_ID", "acf_post_submission", 10, 2);
    
    function acf_post_submission ($entry, $form)
    {
       $post_id = $entry["post_id"];
       $values = get_post_custom_values("YOUR_CUSTOM_FIELD", $post_id);
       update_field("ACF_FIELD_KEY", $values, $post_id);
    }
    

Leave a Comment

tech