Home › Forums › Backend Issues (wp-admin) › Multi-select between Gravity Forms & ACF › Reply To: Multi-select between Gravity Forms & ACF
Yes, but unfortunately it is “manually” reformatting each field. I.e., you have to add your dropdown fields to the list in this function and then it iterates over them to put them in the right format.
add_action('gform_after_submission_14', 'reformat_multiselect', 10, 2);
function reformat_multiselect($entry, $form) {
$post_id = $entry['post_id'];
$selects = array(
'custom_field1' => 'ACF_field_key',
'custom_field2' => 'ACF_field_key',
'custom_field3' => 'ACF_field_key'
);
foreach ($selects as $name => $key) {
$custom = get_post_meta( $post_id, $name, false );
delete_post_meta( $post_id, $name );
$value = maybe_serialize($custom);
if (function_exists('update_field'))
update_field($key,$value,$post_id);
else
add_post_meta($post_id,$key,$value);
}
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.