If you wish to add a post each time a form was submitted, you can do so with the ezfc_after_submission action. Put the following code into your (child-) theme’s functions.php file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function ezfc_insert_post_after_submission($insert_id, $total, $user_mail, $id, $output_data, $submission_data) { // insert to post $new_post_id = wp_insert_post(array( "post_content" => $output_data["result"], //"post_type" => "custom_post_type", "post_title" => "Form #{$submission_data["form_id"]} - Submission #{$id}" )); if ($new_post_id) { foreach ($submission_data["submission_elements_formatted"] as $element_name => $formatted_value) { update_post_meta($new_post_id, $element_name, $formatted_value); } } } add_action("ezfc_after_submission", "ezfc_insert_post_after_submission", 10, 6); |
Alternatively, you can change the variable “post_type” to insert submissions to any custom post type.