bookmark_borderCreate post with custom taxonomy

In this snippet, we will show you how to create a WordPress post using a custom taxonomy.

add_filter( 'gform_post_data', 'custom_taxonomy', 10, 2 );
function custom_taxonomy( $post_data, $form ) {
    //------------------------------------------------------------------------------------
    //post_tag is the default taxonomy for tags. Replace it with your custom taxonomy name
    $custom_taxonomy = 'post_tag';
    //------------------------------------------------------------------------------------
    $tags = implode( ',', $post_data['tags_input'] );
    $post_data['tax_input'] = array( $custom_taxonomy => $tags );
    $post_data['tags_input'] = null;
    return $post_data;
}