Using the Gravity Forms Advanced Post Creation add-on with ACF Custom Database Tables

The Gravity Forms Advanced Post Creation Add-on doesn’t appear to use ACF’s API functions in order to save post meta on newly created posts. It’s likely using core meta functions such as update_post_meta() instead of ACF’s update_field() and in doing so, the ACF Custom Database Tables plugin doesn’t have a chance to intercept the call and store the data in the appropriate custom database table.

In order to make the plugins work together, it’s necessary to hook into the post creation process and save the field values using ACF’s update_field() function. This will allow ACF Custom Database Tables to locate the appropriate custom DB table and store data there.

An example of this is provided in the below snippets and is based on the Gravity Forms documented approach here.

<?php
add_action( 'gform_advancedpostcreation_post_after_creation', function ( $post_id, $feed, $entry, $form ){
// Use ACF's update_field() function in order to save the ACF field data correctly. This will
// ensure ACF Custom Database Tables can store the data in the appropriate tables.
update_field( 'my_field_1', $entry['3'], $post_id);
update_field( 'my_field_2', $entry['6'], $post_id);
update_field( 'my_field_3', $entry['8'], $post_id);
}, 10, 4 );

Caveats

Given the Gravity Forms Advanced Post Creation Add-on is using core meta functions, ACF Custom Database Tables won’t be able to properly bypass core meta storage when configured to do so.

Using ACF Forms as a simpler alternative

For a more cohesive approach, consider using the Advanced Forms Pro plugin for front end forms that create/edit posts. It uses ACF’s API functions correctly and is compatible with ACF Custom Database Tables.

About the author

Phil Kurth is a web developer living in Melbourne, Australia. Phil has a long history of WordPress development and enjoys building tools to empower others in their web design/development practice.

When not working with the web, Phil is usually spending time with his two young sons or is out hiking through the Australian bush.

Good dev stuff, delivered.

Product news, tips, and other cool things we make.

We never share your data. Read our Privacy Policy

© 2016 – 2024 Hookturn Digital. All rights reserved.