I've created a custom post type and taxonomy using Custom Post Type UI plugin. There is a form on the frontend that when filled out creates a new post in the custom post type Survey. I'd like for the title of the post (this is dynamically added based on another post) to be the taxonomy term, custom taxonomy is survey_category. I found this:
add_action('publish_survey', 'add_survey_term');
function add_survey_term($post_ID) {
global $post;
$survey_post_name = $post->post_name;
wp_insert_term( $survey_post_name, 'survey_category');
}
but it doesn't seem to work. I need it to insert the term and if the term already exists I need it to update the number of posts associated with that term.