Support

Account

Home Forums Front-end Issues FrontEnd Forms works locally, but not live

Helping

FrontEnd Forms works locally, but not live

  • 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):Broken Posts

    Everything does work fine and as expected locally, just not live. Any ideas why?

    Thanks

  • Hi @miked89

    That is quite odd.

    Kindly check the ensure that the field groups ID as the same.

    If the issue is persistent, do open a support ticket as [email protected]

    Cheers.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘FrontEnd Forms works locally, but not live’ is closed to new replies.