$post_title, 'post_content' => $post_content, 'post_category' => $post_category, 'tags_input' => $post_tags, 'post_status' => 'publish', 'post_type' => $post_type ); $post_id = wp_insert_post($post); if (!empty($post_format)) { $post_format = $_POST['post_format']; set_post_format($post_id, $post_format); } if (!empty($_POST['evol_manual_content'])) { update_post_meta($post_id, 'evol_manual_content', 'yes'); } if (!empty($_FILES['file_0']['name'])) { foreach ($_FILES as $file_id => $array) { if($file_id=="file_0") { $featuredImage = true; $attachment_id = insert_attachment($file_id,$post_id,$featuredImage); } else { $featuredImage = false; $attachment_id = insert_attachment($file_id,$post_id,$featuredImage); } } } unset($_POST); $location = $_SERVER["REQUEST_URI"]; echo ""; } ?>