So I've got a form which needs to dynamically create a group of checkboxes based on a custom taxonomy and then, when submitted, apply those values to the post that is getting submitted (a custom post type called "marblestag_band").
So far, my code successfully retrieves the custom taxonomy values and applies them to the form (so I successfully end up with a group of checkboxes with correct labels and values for each term in the custom taxonomy). The form also successfully creates a new post of the custom post type in the WordPress back end. Unfortunately, however, it does not apply the checked values to the post, so it does not get categorized at all.
Looking into this, as far as I can tell the only way to define specific terms for a custom taxonomy for a post is to do so using wp_insert_post and the 'tax_input' array. If I hard code the values into gform_post_data (for example, if I put in $post_data["tax_input"] = array('genre' => '3,4,5'), the correct custom terms get applied to the post. However, when I try to pull those values from the checkboxes themselves, the terms get lost.
I then wanted to test what values WERE getting pulled: apparently it's the old default values for the original checkbox (BEFORE the custom taxonomy options were added to the checkbox field). So let's say my checkboxes are input 14 and the original values are the default "First Choice", "Second Choice", "Third Choice" but my custom taxonomy terms are "Rock", "Pop", and "Soul". Using my code, they display on the form page as "Rock", "Pop", and "Soul" (as they should) but gform_post_data retrieves their values as "First Choice", "Second Choice", "Third Choice" (which is incorrect).
It appears that gform_post_data is getting its information BEFORE the form is getting updated by gform_pre_render.
You can see the code I wrote for this here: http://www.pastie.org/1855574
Bottom line is this: I would like to apply dynamic custom taxonomy terms defined by checkboxes to my posts from Gravity Forms. The way I'm doing it right now seems like it should work to me but doesn't. Anyone have any ideas what I'm doing wrong?
Thanks in advance,
PS - What's doubly weird is that if I use a drop-down instead of checkboxes, it works. But I need checkbox functionality.