Skip to content

Instantly share code, notes, and snippets.

@alpha1
Created August 23, 2016 07:54
Show Gist options
  • Save alpha1/2e313c216cc725fc9a1ba09e8513e8cc to your computer and use it in GitHub Desktop.
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
<?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