I use the code like below in a submit page.
$new_post = array(
'post_title' => $title,
'post_content' => $description,
'post_excerpt' => $excerpt,
'post_category' => array($_POST['cat']),
'tags_input' => array($tags),
'post_status' => 'publish',
'post_type' => 'custom_post_type'
$pid = wp_insert_post($new_post);
The $_POST['cat'] fetches the correct category id. My custom taxonomy is named directory. I am able to view in the saved post in the backend but the category checkbox is not checked there and in the front end i am displaying the post under these custom category, but it doesnt appear. Is there a way to save the custom category of a custom taxonomy properly.