Support

Account

Home Forums ACF PRO how to create front end form data add in post Reply To: how to create front end form data add in post

  • i did.. not work. i added

    function my_pre_save_post( $post_id ) {
    
        // check if this is to be a new post
        if( $post_id != 'new' ) {
    
            return $post_id
    
        }
    
        // Create a new post
        $post = array(
            'post_status'  => 'draft' ,
            'post_title'  => 'A title, maybe a $_POST variable' ,
            'post_type'  => 'post' ,
        );  
    
        // 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', 10, 1 );
    

    this to in function.php too it show me error line 120. which is `
    return $post_id
    }`

    my template file code is

    			<?php 
        $args = array(
            'field_groups' => array('members-field')), // Field Group name
            'post_id' => 'new_post',
            'new_post' => array(
                'post_type' => 'members ',  // category name
                'post_status' => 'draft'
             ),
            'submit_value' => 'Submit Application'
        );
        acf_form(); 
    ?>

    still waiting for support ticket response