Hello,
Ive been able to accomplish what’s suggested here to create a front-end form which creates a post:
https://support.advancedcustomfields.com/forums/topic/how-to-wrap-field-groups/
However, I’d like to confirm, should I register two separate forms? Does this cause any unintended issues?
add_action('acf/init', 'test__acf_create_deal');
function test__acf_create_deal() {
// Check function exists.
if( function_exists('acf_register_form') ) {
// Register form.
acf_register_form(array(
'id' => 'new-deal-1',
'post_id' => 'new_post',
'field_groups' => array('18'),
'form' => false,
'new_post' => array(
'post_type' => 'deal',
'post_status' => 'publish'
),
'post_title' => false,
'post_content'=> false,
));
// Register form.
acf_register_form(array(
'id' => 'new-deal-2',
'post_id' => 'new_post',
'field_groups' => array('8'),
'form' => false,
'new_post' => array(
'post_type' => 'deal',
'post_status' => 'publish'
),
'post_title' => false,
'post_content'=> false,
));
}
}
on the front-end, I have this wrapped in a form:
<div id="field-group-1" class="tab">
<?php acf_form('new-deal-1');?>
</div>
<div id="field-group-2" class="tab">
<?php acf_form('new-deal-2');?>
</div>
Since there’s only one form on the front-end, there should be only one submit however, since there’s two registrations, is this saving twice? is there a better way to achieve this?
Thanks!