Hi there,
I’m using acf_form()
to show a form that creates a custom post type on the front end. After this form submits, I want to send the user to a URL with either a query_var or url parameter via the 'return'
option.
Here’s my code, but the $post_id is not passing through…
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'my_cpt',
'post_status' => 'publish',
),
'field_groups' => array(
1234
),
'return' => home_url('my-uri/?mycpt_id=' . $post_id),
'submit_value' => __("Create CPT", 'acf'),
'uploader' => 'wp'
Thanks in advance
Figured it out
function my_save_func($post_id) {
$GLOBALS['acf_form']['return'] = home_url('my-uri/?mycpt_id=' . $post_id);
}
add_action('acf/save_post', 'my_save_func', 20, 1912);