Home Forums Front-end Issues Custom Taxonomy With Text Input Reply To: Custom Taxonomy With Text Input

  • I add bellow code to the theme function.php

    $post = array(
            'post_status'  => 'publish',
            'post_title'  => $_POST["fields"]['field_52e6af7f6f4b8'] ,
    	'post_content' => $_POST["fields"]['field_52e6af906f4b9'],
            'post_type'  => 'post' 
        // insert the post
        $post_id = wp_insert_post( $post ); 
        update_field('field_52e6afd36f4bc', $_POST['field_52e6afd36f4bc'], $post_id);
        // update $_POST['return']
        $_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );    
        // return the new ID
        return $post_id;

    where “field_52e6afd36f4bc” is the field key of custom taxonomy “rent”. I don’t understand what is update_field()’s $value for frontend new post, where user insert a value, not like the example- $value=”some string”.

    And where I put update_field(), into function.php or templete.php.