# Allow Network Signups Only From Certain Email Domains

> Rejects user signups on the network unless the email address belongs to one of your domains, such as a school or company network.

- Type: PHP
- Runs: Run everywhere
- Category: [Multisite](https://wpide.com/library/category/multisite/)
- Tags: signup, email, domains
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/ms-signup-allowed-email-domains/

## Code

```php
if ( ! is_multisite() ) {
    return;
}

$wpide_domains = array( 'example.com', 'example.org' ); // Allowed email domains.

add_filter( 'wpmu_validate_user_signup', function ( $result ) use ( $wpide_domains ) {
    $email  = isset( $result['user_email'] ) ? strtolower( $result['user_email'] ) : '';
    $domain = substr( strrchr( $email, '@' ), 1 );

    if ( $email && ! in_array( $domain, array_map( 'strtolower', $wpide_domains ), true ) ) {
        $result['errors']->add( 'user_email', 'Please sign up with your organisation email address.' );
    }

    return $result;
} );
```

## Notes

This works alongside the "Limited Email Registrations" field in Network Settings; use either one.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Allow Network Signups Only From Certain Email Domains" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
