Hi Support
I am trying to get CPT Taxonomies working using Gravity Forms.
The first form with ID 1 works, however I cannot get the 2nd form Taxonomies to work using the same method could someone possibility suggest what I have done incorrect?
('add_filter("gform_post_data", "empty_tags", 10, 2);
function empty_tags($post_data, $form){
//replace 4 with your actual form id
if($form["id"] !=1){$post_data["tags_input"] = null;}
if($form["id"] !=2){$post_data["tags_input"] = null;}
return $post_data;
}
add_filter("gform_post_submission", "insert_custom_taxonomies", 10, 2);
function insert_custom_taxonomies($entry, $form){
//REPLACE 4 with your actual form id
if($form["id"] !=1)
return;
//getting post
$post_id = $entry["post_id"];
//REPLACE 2 with your actual field id and "post_tag" with your custom taxonomy
wp_set_object_terms($post_id, explode(",", $entry[7]), "directory-province");
//REPLACE 3 with your actual field id and "activities" with your second taxonomy
wp_set_object_terms($post_id, explode(",", $entry[8]), "directory-type");
//REPLACE 4 with your actual form id
if($form["id"] !=2)
return;
//getting post
$post_id = $entry["post_id"];
//REPLACE 2 with your actual field id and "post_tag" with your custom taxonomy
wp_set_object_terms($post_id, explode(",", $entry[4]), "classified-province");
//REPLACE 3 with your actual field id and "activities" with your second taxonomy
wp_set_object_terms($post_id, explode(",", $entry[5]), "classified-type");
}
')
Thanks in advance