The gform_email_confirm Gravity Forms PHP filter is used to modify the “Confirm Email” label in the email field.
Table of contents
Usage
To apply the filter to all forms, use the following code:
add_filter('gform_email_confirm', 'change_email_confirm', 10, 2);
To apply the filter to a specific form, use the following code (replace ‘5’ with the desired form ID):
add_filter('gform_email_confirm_5', 'change_email_confirm', 10, 2);
Parameters
- $label (string): The label to be filtered.
- $form_id (integer): The current form’s ID.
More information
See Gravity Forms Docs: gform_email_confirm
Examples
Change the default “Confirm Email” label
This example changes the default “Confirm Email” label to “Confirm Your Email”:
add_filter('gform_email_confirm', 'change_email_confirm', 10, 2);
function change_email_confirm($label, $form_id) {
return 'Confirm Your Email';
}
Change the “Confirm Email” label for form ID 7
This example changes the “Confirm Email” label for form ID 7 to “Please Verify Your Email Address”:
add_filter('gform_email_confirm_7', 'change_email_confirm_for_form_7', 10, 2);
function change_email_confirm_for_form_7($label, $form_id) {
return 'Please Verify Your Email Address';
}
Change the “Confirm Email” label based on form ID
This example changes the “Confirm Email” label based on the form ID:
add_filter('gform_email_confirm', 'change_email_confirm_based_on_form_id', 10, 2);
function change_email_confirm_based_on_form_id($label, $form_id) {
if ($form_id == 3) {
return 'Re-enter Your Email';
}
return 'Confirm Email Address';
}
Add a custom CSS class to the “Confirm Email” label
This example adds a custom CSS class to the “Confirm Email” label:
add_filter('gform_email_confirm', 'add_custom_css_class', 10, 2);
function add_custom_css_class($label, $form_id) {
return '<span class="custom-email-confirm">' . $label . '</span>';
}
Modify the “Confirm Email” label with additional text
This example adds additional text to the “Confirm Email” label:
add_filter('gform_email_confirm', 'add_additional_text', 10, 2);
function add_additional_text($label, $form_id) {
return $label . ' (This is important!)';
}