попробуйте этот код
<?php
if(isset($_POST['submit'])) {
$post_title = $_POST['post_title'];
$post_category = $_POST['cat'];
$post_content = $_POST['post_content'];
$custom1= $_POST['add_info'];
$image_name=$_FILE['feture_image']['name'];
$image_url=$_FILE['feture_image']['tmp_name'];
$new_post = array(
'post_type' => 'news',
'post_content' => $post_content,
'post_title' => $post_title,
'post_status' => 'publish'
);
$post_id = wp_insert_post($new_post);
$post = get_post($post_id);
add_post_meta($post_id, '_add_info_data', $custom1);
wp_set_object_terms( $post_id, array($post_category), '< category_slug_name >' );
$upload_dir = wp_upload_dir();
$image_data = file_get_contents($image_url);
$filename = basename($image_url);
if(wp_mkdir_p($upload_dir['path'])) $file = $upload_dir['path'] . '/' . $filename;
else $file = $upload_dir['basedir'] . '/' . $filename;
file_put_contents($file, $image_data);
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_title' => sanitize_file_name($filename),
'post_content' => '',
'post_status' => 'inherit'
);
$attach_id = wp_insert_attachment( $attachment, $file, $post_id );
require_once(ABSPATH . 'wp-admin/includes/image.php');
$attach_data = wp_generate_attachment_metadata( $attach_id, $file );
$res1= wp_update_attachment_metadata( $attach_id, $attach_data );
$res2= set_post_thumbnail( $post_id, $attach_id );
}
?>
<form method="post" enctype="multipart/form-data" >
<input type="text" name="post_title" size="45" id="input-title"/>
<?php wp_dropdown_categories('orderby=name&hide_empty=0&exclude=1&hierarchical=1&taxonomy=< taxonomy name >&post_type=< post_type >'); ?>
<textarea rows="5" name="post_content" cols="66" id="text-desc"></textarea>
<input type="file" name="feture_image">
<input type="text" name="add_info">
<input class="subput round" type="submit" name="submit" value="Post"/>
</form>