Support

Account

Home Forums Front-end Issues Front End Uploading Reply To: Front End Uploading

  • I think i am,

    
    function PreSaveForm( $post_id ) {
    
        if ( ! ( is_user_logged_in() || current_user_can('publish_posts') ) ) {
            return;
          }
    
        // check if this is to be a new post
        if( $post_id != 'new' ) {
            return $post_id;
        }
    
        // Create a new post
        $post = array(
            'post_type'     => 'file', // Your post type ( post, page, custom post type )
            'post_status'   => 'publish', // (publish, draft, private, etc.)
            'post_title'    => wp_strip_all_tags($_POST['acf']['field_55ba5b162db22']), // Post Title ACF field key
        );
    
        // insert the post
        $post_id = wp_insert_post( $post );
        // Save the fields to the post
        do_action( 'acf/save_post' , $post_id );
    
        return $post_id;
    }
    add_filter('acf/pre_save_post' , 'PreSaveForm' );
    

    How would i fix this ?