$title, 'post_content' => $description, 'post_category' => array($_POST['cat']), // Usable for custom taxonomies too 'tags_input' => array($tags), 'post_status' => 'publish', // Choose: publish, preview, future, draft, etc. 'post_type' => 'post', //'post',page' or use a custom post type if you want to 'winerating' => $winerating ); //SAVE THE POST $pid = wp_insert_post($new_post); //KEEPS OUR COMMA SEPARATED TAGS AS INDIVIDUAL wp_set_post_tags($pid, $_POST['post_tags']); //REDIRECT TO THE NEW POST ON SAVE $link = get_permalink( $pid ); wp_redirect( $link ); //ADD OUR CUSTOM FIELDS add_post_meta($pid, 'rating', $winerating, true); //INSERT OUR MEDIA ATTACHMENTS if ($_FILES) { foreach ($_FILES as $file => $array) { $newupload = insert_attachment($file,$pid); // $newupload returns the attachment id of the file that // was just uploaded. Do whatever you want with that now. } } // END THE IF STATEMENT FOR FILES } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM //POST THE POST YO do_action('wp_insert_post', 'wp_insert_post'); ?>