### [Customizing the Form Locker Age Verification Message](https://wpforms.com/developers/customizing-the-form-locker-age-verification-message/)

**Published:** December 13, 2022
**Author:** Editorial Team

**Excerpt:** This tutorial will show you how to customize the Form Locker age verification error message that is displayed when your requirements aren't met. 

**Content:**

## Introduction

Want to personalize the age verification message shown by the **Form Locker** addon if a user’s age doesn’t match your requirements? By default, when you configure the **Form Locker** settings to demand age verification, a standard message is displayed for users whose birthdate doesn’t meet the criteria. With a simple PHP snippet, you can tailor this message to suit your preferences. We’ll guide you through the process!

## Creating the form

Let’s get started by crafting a new form and incorporating the necessary fields.

After adding your desired fields, navigate to the **Settings** tab and locate **Form Locker**. Activate verification by clicking the **Enable verification** button. From the **Type** dropdown, opt for **Age**.

Feel free to include a personalized message that will appear before your form, explaining to users the reason for requesting their birthdates.

![create your form, add your fields and enable the age verification on the Form Locker tab](https://wpforms.com/wp-content/uploads/2022/12/wpforms-form-locker-restriction-enable.jpg)

If you need any assistance with creating this type of form, [please check out this documentation](https://wpforms.com/docs/how-to-install-and-use-the-form-locker-addon-in-wpforms/#agehttps://wpforms.com/docs/how-to-install-and-use-the-form-locker-addon-in-wpforms/#age "Form Locker Addon").

## Adding the snippet

Now it’s time to add the snippet to your site. If you need help with how and where to add snippets, [please check out this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/**
 * Customize the Form Locker Verification Error Message
 *
 * @link https://wpforms.com/developers/customizing-the-form-locker-age-verification-message/
 */
 
function wpf_dev_form_locker_restriction_message( $message, $form_id, $form_data ) {

	// Only run on my form with ID = 2189
    if ( absint( $form_data[ 'id' ] ) !== 2189 ) {
        return $message;
    } 
     
    // Change the verification error message
    $message = __('You are unable to apply as an individual volunteer because you do not meet the minimum age requirement. Please contact the site admin with other ways you can help support the cause.', 'text-domain');
	
    return $message;
	
}
 
add_filter( 'wpforms_form_locker_age_get_error_message', 'wpf_dev_form_locker_restriction_message', 10, 3 );

```

This snippet will only run on the form ID **2189**, you will need to update this ID to match your own. For assistance in finding your form ID, [please review this tutorial](https://wpforms.com/developers/how-to-locate-form-id-and-field-id/ "How to Locate Form ID and Field ID").

When a visitor doesn’t meet the age verification check now, they will see your customized message.

![using this snippet you can now customize the age verification message](https://wpforms.com/wp-content/uploads/2022/12/wpforms-form-locker-restriction-message.jpg)

And that’s all you need to customize the message! Would you like to show the number of entries left on a form with the **Form Locker** addon’s entry limit? Check out our tutorial on [How to Display Remaining Entry Limit Number](https://wpforms.com/developers/how-to-display-remaining-entry-limit-number/ "How to Display Remaining Entry Limit Number").

**Categories:** Tutorials

**Tags:** Form Locker Addon, PHP

---

