Created
November 4, 2021 17:28
-
-
Save cybersholt/7a3f3805ed9d9175a29166e8657c1934 to your computer and use it in GitHub Desktop.
Better Elementor Forms Email Validation Message
This file contains 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_action( 'elementor_pro/forms/validation', function ( $record, $ajax_handler ) { | |
$email = $record->get_field( [ 'id' => 'email' ] ); | |
if ( $email ) { | |
if ( ! filter_var( $email['email']['value'], FILTER_VALIDATE_EMAIL ) ) { | |
$ajax_handler->add_error( $email['email']['id'], 'The email address is invalid.' ); | |
} | |
} | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment