Home Forums Front-end Issues Front end form create term


Front end form create term

  • Hello, I’m working on a form to create (and after manage it with the values) terms from a CPT. I would like to have an front-end form to do that.
    Now, with my code, I can create a new term, but the others fields (in the group 390 : adresse, phone, etc) doesn’t accept the value. This fields are desperately empty. What can I do, what is wrong in my code. Any help is welcome ! Thanx in advance !

     * Template Name: create illustrateur
      function save_illustrator( $post_id ) {
        // check if this is to be a new post
        if( $post_id != 'new' )
            return $post_id;
        // Create a new term
    $new_term =  $_POST['acf']['field_5ee62e83a2b4d'] // this is my field title;
        $post_id = wp_insert_term( 
           'adresse' => $adresse =  $_POST['acf']['field_5ead99082e3f7'] ,
      $_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );
        // return the new ID
        return $post_id;
    add_filter('acf/pre_save_post' , 'save_illustrator' );
    <form id="post" class="acf-form" action="" method="post">
    <h4 class="form">Creation </h4>    
        <?php acf_form( array(
            'post_id'	=> 'new',
            'field_groups' => array(632, 390), //632 : My Title 390 My others fields (contact, adresse)
            'form' => false,
    		'post_status'	=> 'publish',
    		//'post_type'		=> 'livret',
    		'updated_message'    => 'La nouvelle ficher vient d’être créée. ',
            'html_updated_message'  => '<div id="message" class="updated"><p>%s</p></div>',
        )); ?>
        <div class="field">
            <input type="submit" value="Creation">
        <?php get_footer(); ?>
Viewing 1 post (of 1 total)

The topic ‘Front end form create term’ is closed to new replies.