Problem: I am using a generic field in my Form but it doesn't seem to save data into my custom field.
Solution: Be sure to use the correct slug. Types fields have a wpcf- prefix in the database, and a generic field should use the same prefix.
add_action('cred_save_data', 'my_save_data_action_choices',10,2); function my_save_data_action_choices($post_id, $form_data) { // if a specific form if ($form_data['id']==34373) { if (isset($_POST['wpcf-roommate-preferences'])) { // add it to saved post meta $emails = $_POST['wpcf-roommate-preferences']; $comma_separated = implode(",", $emails); add_post_meta($post_id, 'wpcf-roommate-preferences', $comma_separated, true); } } }
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 3 replies, has 2 voices.
Last updated by 4 years, 10 months ago.
Assisted by: Christian Cox.