Skip to content

Instantly share code, notes, and snippets.

@cybersholt
Created November 4, 2021 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybersholt/7a3f3805ed9d9175a29166e8657c1934 to your computer and use it in GitHub Desktop.
Save cybersholt/7a3f3805ed9d9175a29166e8657c1934 to your computer and use it in GitHub Desktop.
Better Elementor Forms Email Validation Message
<?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