Hello,
I wish to capture data in a front end form using acf_form(). I only wish to capture data in a selection of fields including a selection of sub fields of a group.
For example, I have a group field ‘product’ which has some child fields ‘name’, ‘code’ and ‘intro’.
I only wish to display and update fields ‘code’ and ‘intro’ via my front enf form.
To do this I use the following code:
acf_form(array(
'post_id' => 'new_post',
'post_title' => false,
'post_content' => false,
'fields' => array(
'field_5cd2c74962c37', //code
'field_5cc079392541f', //intro
),
'submit_value' => 'Create Product',
'new_post' => array(
'post_type' => 'product',
'post_status' => 'draft'
)
));
After submitting the form, the data is not present in the dashboard view and upon inspection of the wp_postmeta table for the post_id, I can see that the meta_key values are ‘code’ and ‘intro’ rather than ‘product_code’ ‘product_intro’ as would be expected as they are sub_fields.
Is this expected behaviour? I would be very grateful for any pointers here.
I have tried to submit this post 3 times now but it’s not submitting for some reason and disappears each time. Please remove if duplicate.
Thanks