Support

Account

Forum Replies Created

  • Inspect it at the browser, the html.

  • Nevermind!

    I got it! The field number: [‘field_5344021b6851b’],
    Appeared after I inspected the element.

  • rdck, I’ve done what you said:

    ‘post_title’ => $_POST[‘fields’][‘field_5344021b6851b’],

    Mine was:
    $_POST[‘fields’][‘nome_do_evento’],

    And it doesn’t work.

    Can you figure it out on my functions.php?

    
    // Create the frontend form
    function my_pre_save_post( $post_id ) {
    	if ( $post_id != 'new' ) {
    		return $post_id;
        }
        $post = array(
            'post_status' => 'draft',
            'post_title' => 'teste', $post_title, $_POST['nome_do_evento']['value'],
            'post_type' => 'post'
        );  
        $post_id = wp_insert_post($post); 
        $_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );    
        return $post_id;
    }
    add_filter('acf/pre_save_post' , 'my_pre_save_post' );
    

    And the page.php :

    			
     <?php $acf = array(
    	'post_id' => 'new',
    	'field_groups' => array(15),
    	'submit_value' => 'ENVIAR'
    ); ?>
    			
    			
    <?php acf_form($acf); ?>
    
Viewing 3 posts - 1 through 3 (of 3 total)