Skip to content

Instantly share code, notes, and snippets.

@fongreecss
Created February 25, 2019 23:24
Show Gist options
  • Save fongreecss/78573889a9e99e7e195eae0135fdd989 to your computer and use it in GitHub Desktop.
Save fongreecss/78573889a9e99e7e195eae0135fdd989 to your computer and use it in GitHub Desktop.
$post_id = wp_insert_post([
'post_type' => 'contact-form',
'post_title' => $_POST['name']
]);
$data = [
'email' => sanitize_email($_POST['email']),
'first' => sanitize_text_field($_POST['name']),
'last' => sanitize_text_field($_POST['surname']),
'message' => sanitize_textarea_field()($_POST['message']),
'terms' => $_POST['terms'],
];
update_field('form_contact', $data, $post_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment