Fill out the form and use terms such as “access to a “High quality website“, “do follow links“, “Website DA“.
You can also test submitting with a fake Gmail or Hotmail email.
/** START ELEMENTOR FORM SPAM PROTECTION **/
add_action( 'elementor_pro/forms/validation', function ( $record, $handler ) {
// Make sure the form is an instance of Form_Record class
if ( ! $record instanceof \ElementorPro\Modules\Forms\Classes\Form_Record ) {
return;
}
$raw_fields = $record->get('fields');
$fields = [];
foreach ( $raw_fields as $id => $field ) {
$fields[ $id ] = $field['value'];
}
// Define blocked domains
$blocked_domains = ['gmail.com', 'hotmail.com'];
// Define blocked words/phrases
$blocked_words = ['High quality website', 'do follow links', 'Website DA']; // Add your words/phrases here
// Check for blocked domains
if ( isset( $fields['email'] ) ) {
$email_domain = substr(strrchr($fields['email'], "@"), 1);
if ( in_array( $email_domain, $blocked_domains ) ) {
$handler->add_error( 'email', 'Emails from this domain are not accepted.' );
return;
}
}
// Check for blocked words/phrases
foreach ( $fields as $field ) {
foreach ( $blocked_words as $word ) {
if ( strpos( strtolower( $field ), strtolower( $word ) ) !== false ) {
$handler->add_error( 'general', 'Your submission contains blocked words/phrases.' );
return;
}
}
}
}, 10, 2 );
/** END ELEMENTOR FORM SPAM PROTECTION **/