Skip to content

Instantly share code, notes, and snippets.

@dexit
Forked from cybersholt/functions.php
Created November 15, 2024 14:56
Show Gist options
  • Select an option

  • Save dexit/6fb7da5f3be37b0fb4ae379803571f9f to your computer and use it in GitHub Desktop.

Select an option

Save dexit/6fb7da5f3be37b0fb4ae379803571f9f 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