Blocking WordPress Registrations from Specific Email Domains

Blocking WordPress Registrations from Specific Email Domains

WordPress has a feature to allow users to register or create accounts on your website. However, there may be instances when you want to block specific email domains from being able to register on your WordPress site. This could be for security reasons or to prevent spam registrations and abuse.

In this article, we will look at how to block specific email domains from being able to register on your WordPress site.

This article assumes your site uses a custom WordPress user registration form by ProfilePress for its registration or sign-up page.

Banning WordPress User Registration from Specific Email Addresses

Follow the guide below to prevent unwanted users from registering and checking out (when purchasing a paid membership plan) to your WordPress site with an email address in your blocklisted, disallowed, or ban list.

Installing and Activating ProfilePress Plugin

On your WordPress dashboard, go to Plugins > Add New. Next, search for ProfilePress and install the plugin by clicking the “Install Now” button.

Blocking WordPress Registration from Specific Email Domains

Go to ProfilePress >> Settings >> Access >> Blocked Email Addresses.

Enter into the textarea the email addresses to block, one per line.

Say you want to block user registration and checkout from yahoo email addresses; enter into the box

To block user registrations from emails ending with a .gov TLD e.g. [email protected], enter .gov in the box.

Finally, you can block specific email addresses too by entering the full email address.

Users will get an error message when they try to checkout, sign up, create an account, or register to your WordPress site with a banned or blocked email address.

Restricting WordPress Registration to Specific Domains

Use the code below to restrict WordPress registration to selected domains. For example, say domains with an email address from a specific company, e.g., email addresses ending with and

Add the code below to your theme’s functions.php file or implement it with a code snippet plugin.

add_filter('ppress_registration_validation', function ($reg_errors, $form_id, $user_data) {

    $valid_email_domain = ['', ''];

    if ( ! empty($user_data['user_email'])) {

        $explode = explode('@', $user_data['user_email']);

        if (isset($explode[1]) && ! in_array($explode[1], $valid_email_domain)) {
            $reg_errors->add('invalid_email_domain', __('Email address you are registering with is not supported.'));

    return $reg_errors;

}, 999999999, 3);


Blocking WordPress registration from specific email domains can be valuable for website administrators who want to control the types of users that can register on their site. It can also help prevent spam or unwanted registrations from specific domains and can be used to restrict access to particular groups of users.

While this feature may not be necessary for all websites, it can be helpful for those who want to maintain control over their user base and protect their site from potential security threats.