Forminator with ACF Using Custom Post Type
-
Hi there,
I’m trying to pass through an ACF from a field on the page where the form is submitted. In this case, we have franchises listed and we want to pass through the contact email for the franchise as a custom value.
I’m using this code:
add_filter( 'forminator_field_hidden_field_value', function( $value, $saved_value, $field ){
if( ! empty( $field['default_value'] ) && 'custom_value' === $field['default_value'] && strpos( $value, 'acf_' ) !== false ){
$field_keys = explode('acf_', $value );
$post_id = false;
$value = get_field( $field_keys[1], $post_id );
}
return $value;
}, 9999, 3 );And the ACF field’s name is: contact_email
In Forminator, I have a hidden field with the custom value of acf_contact_email, however, every time I submit the form, it is showing as blank. I am using a custom post type called Franchises. Is this possibly why? If so, there is a way to make this work with custom post types?
Thank you so much for any help! I love Forminator and use it on all my websites!
- The topic ‘Forminator with ACF Using Custom Post Type’ is closed to new replies.