add_filter('wpcf7_validate_email*', 'custom_cf7_email_blocker', 20, 2); add_filter('wpcf7_validate_email', 'custom_cf7_email_blocker', 20, 2); function custom_cf7_email_blocker($result, $tag) { $blocked_emails = [ 'blocked@example.com', 'debbie@ddsrank.com' ]; $blocked_domains = [ 'baddomain.com', 'spamdomain.com' ]; $email = isset($_POST[$tag->name]) ? trim(strtolower($_POST[$tag->name])) : ''; if ($email) { $email_domain = substr(strrchr($email, "@"), 1); if (in_array($email, $blocked_emails) || in_array($email_domain, $blocked_domains)) { $result->invalidate($tag, "This email address is not allowed."); } } return $result; }