Wordpress Jetpack Contact Confirmation Thank You – Customized

The default confirmation for the Jetpack Contact Form is something like “Message Received (go back)” and the fields submitted. What if we want to something a little more user friendly? The basic contact form doesn’t allow for that, so I created a custom one.

put this in your function.php:

function amgenna_change_grunion_success_message( $msg ) {
global $contact_form_message;
$url = explode(‘?’, ‘http://’.$_SERVER[“HTTP_HOST”] . $_SERVER[“REQUEST_URI”]);
$ID = url_to_postid($url[0]);
$msg=”Thanks for contacting us!”;

if (get_post_meta($ID, ‘Form Confirmation’, true)) {$msg=get_post_meta($ID, ‘Form Confirmation’, true)};
return ‘<h3>’ . $msg . ‘</h3>’ . wp_kses($contact_form_message, array(‘br’ => array(), ‘blockquote’ => array()));
}
add_filter( ‘grunion_contact_form_success_message’, ‘amgenna_change_grunion_success_message’ );

It determines what the post ID is based on the URL, then sets the confirmation message if there is a custom field named “Form Confirmation” on the page. If so, it uses that; if not, it uses the default, “Thanks for contacting us!”.

Hope this helps!