How to make a WooCommerce registration email blacklist

For whatever reason it can be useful to block specific email addresses from account registration in WooCommerce. To accomplish this you need an email blacklist. With only a few lines of code you can check if the entered email address is listed in your blacklist even before a user account is generated and echo an error message to the registration/login page of WooCommerce. To do so, just add this code snippet to your (child-)themes functions.php:

function tk_check_email_on_registration( $errors, $username, $email ) {

    $blacklist = array( '[email protected]', '[email protected]');

    if ( in_array( $email, $blacklist ) ) {
        $errors->add( 'blacklist_error', 'This email is not allowed to register on this site.' );

    return $errors;

add_filter( 'woocommerce_registration_errors', 'tk_check_email_on_registration', 10, 3 );


Leave a Comment

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