Great hooks and documentation!
I wanted to post a solution to a process we are putting into place. I hope it helps someone!
We are using a form to gather post submissions. We wanted the user to be able to select a category, but we also wanted to force submission into a particular category. When we add the category selection field to the form, the ability to add a default category is removed from the form options.
This worked:
add_filter("gform_post_data", "change_cat", 10, 2);
function change_cat($post_data, $form) {
//Set the ID for the form you wish to execute this function
$form_id = 1;
//Set the ID for the Category you wish to
$cat_id = 1;
if($form["id"]==$form_id) {
array_push($post_data[post_category], $cat_id);
}
return $post_data;
}
If you have another way to do this, I'd love to know!