I have created an option in a WordPress admin to create a post by the inputs from user, user can also select custom taxonomy terms there. Now the problem is that the post has been created successfully but not assigned to selected term.
I have used wp_insert_post and wp_set_object_terms functions to do so. I have also tried with wp_set_post_terms. But still the post (custom post) not assigned to selected term.
I have checked all the parameters are correct before passed them to function.
One more thing I would like to say is that this function(wp_insert_post) works with WordPress default taxonomy(category). Also I can able to assign terms using WordPress manually but it fails to do so programmatically.
Please have a look over this.