The gform_get_form_save_confirmation_filter Gravity Forms PHP filter allows you to change the form save confirmation text programmatically before it’s rendered to the page.
Usage
Applies to all forms:
add_filter('gform_get_form_save_confirmation_filter', 'your_function_name', 10, 2);
To target a specific form, append the form ID to the hook name (format: gform_get_form_save_confirmation_filter_FORMID):
add_filter('gform_get_form_save_confirmation_filter_10', 'your_function_name', 10, 2);
Parameters
- $confirmation_message (string) – The confirmation text.
- $form (Form Object) – The form currently being processed.
More information
See Gravity Forms Docs: gform_get_form_save_confirmation_filter
Examples
Add a note to the save confirmation message
In this example, we add a custom note to the save confirmation message:
add_filter('gform_get_form_save_confirmation_filter_10', 'add_note_to_save_confirmation', 10, 2);
function add_note_to_save_confirmation($confirmation_message, $form) {
$confirmation_message .= "Please call us at 555-0100 if you need help.";
return $confirmation_message;
}
Replace the confirmation message with a custom message
In this example, we replace the default confirmation message with a custom message:
add_filter('gform_get_form_save_confirmation_filter_10', 'replace_confirmation_message', 10, 2);
function replace_confirmation_message($confirmation_message, $form) {
$confirmation_message = "Your form has been saved successfully. Thank you!";
return $confirmation_message;
}
Add user’s name to the confirmation message
In this example, we add the user’s name to the confirmation message:
add_filter('gform_get_form_save_confirmation_filter_10', 'add_user_name_to_confirmation', 10, 2);
function add_user_name_to_confirmation($confirmation_message, $form) {
$user = wp_get_current_user();
$confirmation_message = "Hello {$user->display_name}, your form has been saved!";
return $confirmation_message;
}
Display the confirmation message in a different language
In this example, we display the confirmation message in Spanish based on the user’s language preference:
add_filter('gform_get_form_save_confirmation_filter_10', 'translate_confirmation_message', 10, 2);
function translate_confirmation_message($confirmation_message, $form) {
$user_language = get_user_meta(get_current_user_id(), 'language', true);
if ($user_language == 'es') {
$confirmation_message = "Su formulario ha sido guardado exitosamente. ¡Gracias!";
}
return $confirmation_message;
}
Add a link to the confirmation message
In this example, we add a link to the confirmation message:
add_filter('gform_get_form_save_confirmation_filter_10', 'add_link_to_confirmation', 10, 2);
function add_link_to_confirmation($confirmation_message, $form) {
$confirmation_message .= " [Click here](https://example.com) to visit our website.";
return $confirmation_message;
}