AI Summary
Description
The wpforms_form_locker_age_get_error_message
filter lets you customize the age verification error message displayed by the Form Locker addon when a user does not meet the minimum age requirement. By default, WPForms shows a standard message, but you can override it with your own wording.
This filter is especially useful when you want to add context-specific language to your forms. For example, you can use it to explain why a user is restricted or suggest alternative actions if they fail age verification.
parameter | type | description |
---|---|---|
$message | string | The default error message shown when the age verification fails. |
$form_id | int | The ID of the current form. |
$form_data | array | The form settings and configuration data. |
Source
wpforms-form-locker\src\Lockers\Age.php
Example
function wpf_dev_custom_age_error( $message, $form_id, $form_data ) {
if ( $form_id === 123 ) {
$message = __( 'Sorry, you must be 18 or older to complete this form.', 'text-domain' );
}
return $message;
}
add_filter( 'wpforms_form_locker_age_get_error_message', 'wpf_dev_custom_age_error', 10, 3 );