Untitled
Anonymous
Plain Text
10/09/2025 8:47 AM
787 B
40
Indexable
Never
add_action( 'elementor_pro/forms/validation/email', function ( $field, $record, $ajax_handler ) {
// Get the submitted email value
$email = sanitize_email( $field['value'] );
// List of disallowed public email domains
$disallowed_domains = [
'gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com', 'live.com',
'aol.com', 'icloud.com', 'mail.com', 'protonmail.com', 'gmx.com',
'zoho.com', 'yandex.com'
];
// Extract domain from email
$domain = strtolower( substr( strrchr( $email, '@' ), 1 ) );
// Check for invalid domain
if ( in_array( $domain, $disallowed_domains, true ) ) {
$ajax_handler->add_error( $field['id'], 'Please use your company email address (not Gmail, Outlook, Yahoo, etc.).' );
}
}, 10, 3 );
Editor is loading...
Leave a Comment