Support

Account

Home Forums General Issues How to show custom field inputs on acf_form() front end when creating new post Reply To: How to show custom field inputs on acf_form() front end when creating new post

  • Hi ch1n3s3b0y

    In its front page you should put something like:

    <?php
    acf_form(array(
    'post_id'		=> 'new_post_emp',
    'field_groups'	=> array( 86 ),
    'return' => add_query_arg( 'updated', 'true',   "http://qgbrain.com.br/web/assesstment/pesquisar-empresa/" ),
    ));
    ?>

    In the function.php you should put:

    <?php
    add_filter('acf/pre_save_post' , 'my_pre_save_post' );
    function my_pre_save_post( $post_id ) {
    
    if( $post_id == 'new_post_emp' ) {
    
    // data send by POST in form
    $title = $_POST['fields']['field_552b299a1844c'];
    
    // Default data post
    $post = array(
    'post_status'	=> 'Publish',
    'post_type'		=> 'processos',
    'post_title'	=> '0000 |'.$title,
    );	
    // action for update
    $post_id = wp_insert_post( $post ); 
    
    }	
    }
    ?>

    this way the created form is available on your front-end

    I hope it helped