View difference between Paste ID: rbepWh1G and b1uWnLTw
SHOW: | | - or go back to the newest paste.
1
add_filter("gform_allowable_tags_13", "allow_basic_tags", 10, 3);
2
function allow_basic_tags($allowable_tags) {
3
	return true;
4
}
5
6
add_action("gform_pre_submission_13", "add_catlink");
7
function add_catlink($form){
8
9
// assuming your dropdown list includes all of the categories in your site the information a user selects will have a category name
10
11
// we then need to grab that category name find out its ID and then build a link
12
$categoryname = $_POST["input_7"];
13
$category_id = get_cat_ID($categoryname);
14
$category_link = get_category_link($category_id);
15
16
// lastly, we need to change the POST value from just being the name of the category to being a link.
17
$_POST["input_7"] = '<a href="'. esc_url($category_link) .'">'. $categoryname .'</a>';
18
19
}