Hi,
I have a page where you a few tabs, in one tab you can create a CPT with the ACF frontend forms, and in another tab you should be able to update the current post.
The CPT creation works fine and as expected, however the existing post to update isnt working.
It pulls in the correct data on load, but if you update the information and click save, nothing saves, the page seems to just refresh.
I have this in my header:
<?php function my_pre_save_post( $post_id ) {
// Create a new post
$post = array(
'post_status' => 'publish' ,
'post_type' => 'acquisitions',
//Use the ACF fields to create the title or any other field.
'post_title' => 'Acquisition' . ' ' . current_time( 'd/m/Y H:i:s', $gmt = 0 ),
);
// insert the post
$post_id = wp_insert_post( $post );
// return the new ID
return $post_id;
}
add_filter('acf/pre_save_post' , 'my_pre_save_post', 1, 1 ); ?>
<?php acf_form_head(); ?>
<?php get_header(); ?>
And the form to update the current post is:
<?php acf_form(); ?>
Any ideas why this isnt updating and working as expected?
Thanks,
Mike