I must be using this hook incorrectly, but I can't figure out how to fix it. I have two forms: one for registered users (id=1) and one for non-registered users (id=3).
For form #3, I'm using the Gravity Forms + Custom Post Type plugin to add a dropdown field connected to a taxonomy called Gender. This way the non-registered user can select their gender and it is associated with the post.
Registered users already have gender attached to usermeta (added during signup). When a registered user fills out form #1 I want it to use their usermeta to set the gender taxonomy.
add_action('gform_post_submission_1', 'be_add_gender', 10, 2);
function be_add_gender($entry, $form){
$data = wp_get_current_user();
$gender = ( 'male' == $data->gender ) ? 'male' : 'female';
wp_set_post_terms( $entry['post_id'], array( $gender ), 'gender' );
}
Even if my usermeta isn't set, $gender defaults to female and it should be placing the post in the 'female' term of the 'gender' taxonomy. When a post is published, no taxonomy terms are selected.