-
-
Save dexit/6fb7da5f3be37b0fb4ae379803571f9f to your computer and use it in GitHub Desktop.
Better Elementor Forms Email Validation Message
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_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