title: front end post submit with custom taxonomy and category
body: <p>On my website i'm buildng a front end post publishing based on this article : </p>
  
  <p><a href="http://voodoopress.com/review-of-posting-from-front-end-form%29/" rel="nofollow">http://voodoopress.com/review-of-posting-from-front-end-form%29/</a></p>
  
  <p>All my posts have both a category and a custom taxonomy.</p>
  
  <p>the problem is that I can't find a way to save both defautt category &amp; custom taxonomy (regions).</p>
  
  <p>when adding this line to code for custom taxonomy "regions", taonomy AND category is not saved :</p>
  
  <pre><code>wp_set_post_terms($pid,array($_POST['reg']),'regions',true);
  </code></pre>
  
  <p>and in my form :</p>
  
  <pre><code> &lt;!-- post Region --&gt;
    &lt;fieldset class="regions"&gt;
      &lt;label for="reg"&gt;Régions :&lt;/label&gt;
      &lt;?php wp_dropdown_categories( 'tab_index=10&amp;taxonomy=regions&amp;hide_empty=0&amp;show_option_all=Choisissez une Région' ); ?&gt;
    &lt;/fieldset&gt;
  </code></pre>
  
  <p>here is my custom taxonomy inside my function.php</p>
  
  <pre><code>// CUSTOM REGION TAXONOMY
  //hook into the init action and call create_book_taxonomies when it fires
  add_action( 'init', 'create_topics_hierarchical_taxonomy', 0 );
  
  //create a custom taxonomy name it topics for your posts
  
  function create_topics_hierarchical_taxonomy() {
  
  // Add new taxonomy, make it hierarchical like categories
  //first do the translations part for GUI
  
    $labels = array(
      'name' =&gt; _x( 'Region', 'taxonomy general name' ),
      'singular_name' =&gt; _x( 'Region', 'taxonomy singular name' ),
      'search_items' =&gt;  __( 'Search Regions' ),
      'all_items' =&gt; __( 'Toutes' ),
      'parent_item' =&gt; __( 'Parent Region' ),
      'parent_item_colon' =&gt; __( 'Parent Region:' ),
      'edit_item' =&gt; __( 'Edit Region' ), 
      'update_item' =&gt; __( 'Update Region' ),
      'add_new_item' =&gt; __( 'Add New Region' ),
      'new_item_name' =&gt; __( 'New Topic Region' ),
      'menu_name' =&gt; __( 'Régions' ),
    );    
  
  // Now register the taxonomy
  
    register_taxonomy('regions',array('post'), array(
      'hierarchical' =&gt; true,
      'labels' =&gt; $labels,
      'show_ui' =&gt; true,
      'show_admin_column' =&gt; true,
      'query_var' =&gt; true,
      'rewrite' =&gt; array( 'slug' =&gt; 'Region' ),
    ));
  
  }
  </code></pre>
  
  <p>here is my front-end php :</p>
  
  <pre><code>&lt;?php
  if( 'POST' == $_SERVER['REQUEST_METHOD'] &amp;&amp; !empty( $_POST['action'] ) &amp;&amp;  $_POST['action'] == "new_post") {
  
    // Do some minor form validation to make sure there is content
    if (isset ($_POST['title'])) {
      $title =  $_POST['title'];
    } else {
      echo 'veuillez entrer un titre';
    }
    if (isset ($_POST['description'])) {
      $description = $_POST['description'];
    } else {
      echo 'veuillez entrer du texte';
    }
  
    $genre = $_POST['genre'];
    $tranche_age = $_POST['tranche_age'];
  
    // ADD THE FORM INPUT TO $new_post ARRAY
    $new_post = array(
    'post_title'  =&gt;  $title,
    'post_content'  =&gt;  $description,
    'post_category' =&gt;  array($_POST['cat']), // Usable for custom taxonomies too
    'post_status' =&gt;  'publish',           // Choose: publish, preview, future, draft, etc.
    'post_type' =&gt;  'post',  //'post',page' or use a custom post type if you want to
    'genre'  =&gt;  $genre,
    'tranche_age'  =&gt;  $tranche_age,
    );
  
  
    //SAVE THE POST
    $pid = wp_insert_post($new_post);
  
  
    wp_set_post_terms($pid,array($_POST['reg']),'regions',true);
  
  
    //REDIRECT TO THE NEW POST ON SAVE
    $link = site_url();
    wp_redirect( $link );
  
    //ADD OUR CUSTOM FIELDS
    add_post_meta($pid, 'genre', $genre, true); 
    add_post_meta($pid, 'tranche_age', $tranche_age, true); 
  
  
  } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM
  
  //POST THE POST YO
  do_action('wp_insert_post', 'wp_insert_post');
  
  ?&gt;
  </code></pre>
  
  <p>and the form :</p>
  
  <pre><code>&lt;!-- FRONT END PUBLISHING --&gt;
  
  &lt;div class="wpcf7"&gt;
  &lt;form id="new_post" name="new_post" method="post" action="" class="wpcf7-form" enctype="multipart/form-data"&gt;
    &lt;!-- post name --&gt;
    &lt;fieldset name="name"&gt;
      &lt;label for="title"&gt;Titre:&lt;/label&gt;
      &lt;input type="text" id="title" value="" tabindex="5" name="title" /&gt;
    &lt;/fieldset&gt;
  
    &lt;!-- post Category --&gt;
    &lt;fieldset class="category"&gt;
      &lt;label for="cat"&gt;Catégorie :&lt;/label&gt;
      &lt;?php wp_dropdown_categories( 'tab_index=10&amp;taxonomy=category&amp;hide_empty=0&amp;show_option_all=Choisissez une catégorie' ); ?&gt;
    &lt;/fieldset&gt;
  
    &lt;!-- post Region --&gt;
    &lt;fieldset class="regions"&gt;
      &lt;label for="reg"&gt;Régions :&lt;/label&gt;
      &lt;?php wp_dropdown_categories( 'tab_index=10&amp;taxonomy=regions&amp;hide_empty=0&amp;show_option_all=Choisissez une Région' ); ?&gt;
    &lt;/fieldset&gt;
  
    &lt;!-- post Content --&gt;
    &lt;fieldset class="content"&gt;
      &lt;label for="description"&gt;Question :&lt;/label&gt;
      &lt;textarea id="description" tabindex="15" name="description" cols="80" rows="10"&gt;&lt;/textarea&gt;
    &lt;/fieldset&gt;
  
    &lt;!-- Genre --&gt;
    &lt;fieldset class="genre"&gt;
      &lt;label for="genre"&gt;Genre&lt;/label&gt;
      &lt;input type="text" value="" id="genre" tabindex="20" name="genre" /&gt;
    &lt;/fieldset&gt;
  
    &lt;!-- Tranche d'âge --&gt;
    &lt;fieldset class="tranche_age"&gt;
      &lt;label for="tranche_age"&gt;Tranche d'âge&lt;/label&gt;
      &lt;input type="text" value="" id="tranche_age" tabindex="20" name="tranche_age" /&gt;
    &lt;/fieldset&gt;
  
    &lt;fieldset class="submit"&gt;
      &lt;input type="submit" value="Envoyer" tabindex="40" id="submit" name="submit" /&gt;
    &lt;/fieldset&gt;
  
    &lt;input type="hidden" name="action" value="new_post" /&gt;
    &lt;?php wp_nonce_field( 'new-post' ); ?&gt;
  &lt;/form&gt;
  &lt;/div&gt; &lt;!-- END WPCF7 --&gt;
  </code></pre>
  
  <p>Does anyone knows what I'm doing wrong ?</p>