Home Forums Backend Issues (wp-admin) gravity forms post creation + afc


gravity forms post creation + afc

  • Trying to use Gravity Forms Advanced Post Creation add-on to create a front end content submission form.

    Most everything works well — have been able to map fields in gravity into my ACF fields.

    Exception is the rich text editor, as all line breaks are wiped out in the process, making that unusable for editorial content.

    The Gravity folks have a tutorial, but the example doesn’t apply, so I’m hoping someone can point me in the right direction as to how to write a filter that will preserve line breaks from Gravity’s rich text editor into the ACF wysiwyg field.

  • @peteratomic
    Could you please tell me/us how did you map fields in gravity into ACF fields?

    Thank you so much!

  • The tutorial linked to is for standard WP custom fields.

    For ACF fields you would use acf function and field keys to update values.

    update_field('field_XXXXX', $value, $post_id);

  • There are a few ways to do this. Here’s one way with the Gravity Advanced Post Creation Add-On that is included with the Gravity Elite License.

    1. Use the APC media merge tag as explained in the video for Matching up Images with Advanced Custom Fields (ACF) or other Custom Fields using the Advanced Post Creation Add-On

    For example, while editing a Post Creation feed and choosing a value for a custom field name under, select “Add Custom Value” at the bottom of the select menu and then enter


    This will assign an attachment post ID to the meta field related to your ACF field. It will not run update_field.

    2. Use the hook gform_advancedpostcreation_post_after_creation_YOURFORMID to run update_field once a post is created:

    add_action('gform_advancedpostcreation_post_after_creation_YOURFORMID', 'my_gf_new_organization', 10, 4);
    function my_gf_new_organization($post_id, $feed, $entry, $form) {
       $logo = get_field('field_LOGO_FIELD_KEY',$post_id);
       if ( $logo && is_numeric($logo) ) { //sanity check
          $logo_id = $logo;
          $update_result = update_field('field_LOGO_FIELD_KEY',$logo_id,$post_id);

    If you do not use the filter, you can alternatively get attachments for the post and look for the one you want that matches entry data. Or you can just get the first attachment if there is only one. Then, use update_field to add it to the post.

    Finally, if you do not need to update_field on post creation or you do not want to, and you do not want to use the gform_advancedpostcreation_post_after_creation at all, you can check to see if get_field returns a numeric value and run update_field before display. If you don’t want to update_field at all, you can also consider using acf_get_attachment (which is fairly undocumented) with the attachment id.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.