Hi guys,
I’m looking to redirect my users to a thank you page after they have submitted a front end post via the acf front end form. An example would be greatly appreciated, here’s my code:
<?php
// functions.php
function my_pre_save_post( $post_id ) {
// Create a new post
$post = array(
'post_status' => 'draft',
'post_title' => $_POST['fields']['field_54100f9716e8d'],
'post_type' => 'pledge',
);
// insert the post
$post_id = wp_insert_post( $post );
// update $_POST['return']
$_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );
// return the new ID
return $post_id;
}
add_filter('acf/pre_save_post' , 'my_pre_save_post' );