最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Block Disposable Emails on Woocommerce Registration

programmeradmin2浏览0评论

Is there any way to block disposable emails on Woocommerce registration? I used this plugin with a list of disposable email domains, but it would only block on regular registration - not Woocommerce registration. Any ideas?

Is there any way to block disposable emails on Woocommerce registration? I used this plugin with a list of disposable email domains, but it would only block on regular registration - not Woocommerce registration. Any ideas?

Share Improve this question asked Aug 19, 2018 at 12:00 25676552222567655222 1012 bronze badges 1
  • github/Ipstenu/ban-hammer/wiki#woocommerce – Sally CJ Commented Aug 19, 2018 at 13:36
Add a comment  | 

2 Answers 2

Reset to default 1

Hi just add this code in your theme functions.php

add_action('init', 'mydomain_plugin_checks');

function mydomain_plugin_checks(){
    if ( class_exists('BanHammer') ) {
        add_filter('woocommerce_registration_errors', 'woocommerce_banhammer_validation', 10, 3 );
    }   
}

function woocommerce_banhammer_validation( $validation_errors, $username, $email ) {
    if( (new BanHammer)->banhammer_drop( $username, $email, $validation_errors ) )
        return new WP_Error( 'registration-error-bad-email', (new BanHammer)->options['message'] );
    return $validation_errors;
}

If I am right, are you asking a WordPress plugin which can validate emails from Woocommerce Registration? If so, there is some WordPress plugin that are capable to solve your problem.

Basically those plugins will get the emails inputted from Woocommerce, validate it and return the result back to the form. Some of the plugin will require you to sign up the API key before use.

Currently I am using MailboxValidator Email Validator, which did a great job on protecting my website from disposable email address.

发布评论

评论列表(0)

  1. 暂无评论