Allow Only Business Email Addresses in the Email Field of Elementor Forms

Accept submissions from Business emails on Elementor Forms

The idea behind Allow Only Business Email Address in the Email Field of Elementor Forms is simple. We are going to blocklist the top popular personal email provider domain so it looks Elementor form email field only works for business emails.

As Elementor Form is available on the Pro version only, You need to have Elementor Pro. If you don’t have one you can get it from here.

we are using Elementor Pro’s action hook to achieve this goal. Put this code on your functions PHP file of the child theme.

// Validate the email fields for valid domains
add_action( 'elementor_pro/forms/validation/email', function( $field, $record, $ajax_handler ) {
// Please include the email domains you would like to block in this list
$invalidDomains = ["@gmail.","@yahoo.","@hotmail.","@live.","@aol.","@outlook."];
	// email validation
	foreach($invalidDomains as $domain){
		if(strpos($field['value'], $domain) !== false){
    	$ajax_handler->add_error( $field['id'], "Must be Business email." ); 
}, 10, 3 );

Here on $invalidDomains variable put all of the TLD that you don’t want to receive email.

That’s all.

Previous Code

Change WordPress URL in Database with phpMyAdmin and SQL query

Replace WordPress old URL to new URL with SQL Quer ...

Next Code

WordPress .htaccess code for redirect www to non www url

Remove www from url or redirect ...

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × four =


Need Coding Help?

Connect Skype