Created
August 23, 2016 07:54
-
-
Save alpha1/2e313c216cc725fc9a1ba09e8513e8cc to your computer and use it in GitHub Desktop.
Gravity Forms: Simple field check to see if the field is an email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'gform_field_validation_3_1', 'email_valdity_check', 10, 4 ); | |
| function email_valdity_check( $result, $value, $form, $field ){ | |
| if( is_email( $value ) ){ | |
| $result['is_valid'] = true; | |
| } else { | |
| $result['is_valid'] = false; | |
| $result['message'] = __( 'Email address is not valud', 'text_domain' ); | |
| } | |
| return $result; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment