// ========================================== // KHF SECURE CONTACT FORM HANDLER // ========================================== add_action( 'admin_post_nopriv_khf_submit_contact', 'khf_handle_contact_form' ); add_action( 'admin_post_khf_submit_contact', 'khf_handle_contact_form' ); function khf_handle_contact_form() { // 1. Verify Security Nonce if ( ! isset( $_POST['khf_contact_security'] ) || ! wp_verify_nonce( $_POST['khf_contact_security'], 'khf_contact_nonce' ) ) { wp_die( 'Security check failed. Please try again.' ); } // 2. Sanitize Inputs $first_name = sanitize_text_field( $_POST['khf_first_name'] ); $last_name = sanitize_text_field( $_POST['khf_last_name'] ); $email = sanitize_email( $_POST['khf_email'] ); $phone = sanitize_text_field( $_POST['khf_phone'] ); // 3. Prepare Email $to = 'info@keansburghouseoffades.com'; // Change this to your actual receiving email $subject = 'New KHF Website Contact: ' . $first_name . ' ' . $last_name; $message = "You have received a new message from the Keansburg House of Fades website.\n\n"; $message .= "Name: " . $first_name . " " . $last_name . "\n"; $message .= "Email: " . $email . "\n"; $message .= "Phone: " . $phone . "\n"; $headers = array('Content-Type: text/plain; charset=UTF-8'); $headers[] = 'From: ' . $first_name . ' <' . $email . '>'; // 4. Send Email & Redirect wp_mail( $to, $subject, $message, $headers ); // Redirect back to homepage with a success query parameter wp_redirect( home_url( '/?contact=success#contact' ) ); exit; } https://keansburghouseoffades.com/page-sitemap.xml 2026-06-27T20:42:50+00:00