# Restrict sign-up to only specific domains

**URL:** <https://community.hivepress.io/t/restrict-sign-up-to-only-specific-domains/17260>\
**Category:** HivePress\
**Tags:** code\
**Created:** [December 17, 2025, 12:13pm UTC](https://community.hivepress.io/t/restrict-sign-up-to-only-specific-domains/17260 "2025-12-17T12:13:04Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![kseniia](https://community.hivepress.io/user_avatar/community.hivepress.io/kseniia/32/13513_2.png) [@kseniia](https://community.hivepress.io/u/kseniia)\
**Post date:** [December 18, 2025, 3:43pm UTC](https://community.hivepress.io/t/restrict-sign-up-to-only-specific-domains/17260/4 "2025-12-18T15:43:09Z")

</div>

Hi,

You can simplify it a little:

```auto
add_filter(
	'hivepress/v1/forms/user_register/errors',
	function ( $errors, $form ) {
		$email = $form->get_value( 'email' );
		if ( strpos( $email, '.edu' ) === false ) {
			$errors [] = 'Only .edu email addresses are allowed.';
		}
		return $errors;
	},
	1000,
	2
);

```

Hope this helps

---

_[View the full topic](https://community.hivepress.io/t/restrict-sign-up-to-only-specific-domains/17260)._
