Ive just transferred a local multisite install on to a single install on to a live server, following instructions here.
However, every front end form is now broken and doesnt create new posts properly.
Here’s the code im using:
<?php function my_pre_save_post( $post_id ) {
// check if this is to be a new post
if( $post_id != 'new_post_name' ) {
return $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', $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(array(
'post_id' => 'new_post_name',
'id' => 'acf-form',
'field_groups' => array('869'),
'return' => '%post_url%',
'submit_value' => 'Create Post'
)); ?>
And this is the post it creates in the Custom Post Type (unable to edit/delete it either):
Everything does work fine and as expected locally, just not live. Any ideas why?
Thanks