I am using the following code to pre-check one of my taxonomy options when using the form to create a custom post type post. When I use this code, submitting the CRED form works, but I am shown the included error as a temporary page before being shown the confirm message. All the data is being passed correctly into the custom post type. You can submit the form above and see the same thing, throw a name and select an option from the dropdown and the form works.
Warning: in_array() expects parameter 2 to be array, string given in /home/issmin/indoorskydivingsource.com/wp-content/plugins/cred-frontend-editor/classes/Form_Builder_Helper.php on line 1646
Warning: in_array() expects parameter 2 to be array, string given in /home/issmin/indoorskydivingsource.com/wp-content/plugins/cred-frontend-editor/classes/Form_Builder_Helper.php on line 1646
Warning: Invalid argument supplied for foreach() in /home/issmin/indoorskydivingsource.com/wp-content/plugins/cred-frontend-editor/classes/Form_Builder_Helper.php on line 1650
Please notice that the generic fields that you add to the form are not part of the post, so CRED will not process them automatically. You are free to use generic fields for whatever your application requires. Your processing should go into PHP code and run on CRED hooks. You can read about CRED Hooks at https://toolset.com/documentation/user-guides/cred-api/
Generally, it looks like you need to handle your generic hidden field, at the event when your custom post is being saved.
Please let me know if I can help you with anything related.
Thanks! Using this code modified to my needs I was able to tackle this:
add_action('cred_save_data', 'my_custom_save_data_action', 10, 2);
function my_custom_save_data_action( $post_id, $form_data ){
// if a specific form
if ($form_data['id']==213){
$tag = array( 5 ); // add the id of your tag 'Thanksgiving'.
$taxonomy = 'custom_taxonomy'; // add the slug of the taxonomy.
wp_set_post_terms( $post_id, $tag, $taxonomy );
}
}