Some membership sites need to limit signups to users with an approved email domain. For example, you might only want members with a company, university, or organization email address to register.

This recipe restricts membership checkout in Paid Memberships Pro to specific email domains that you define.

It could be an automated alternative to using the Approval Process for Membership Add On.

Featured image for code recipe on restricting signup by email domain

Understanding How It Works

This recipe uses the pmpro_registration_checks filter to validate the email address entered during membership checkout.

Paid Memberships Pro runs a series of registration checks before completing checkout. Through this filter, you can run custom logic to determine whether a registration should continue or stop. Returning false from your hooked function prevents the checkout from processing and displays an error message to the user.

About the Code Recipe

This recipe validates a user’s email domain during checkout and blocks registrations from unapproved domains. You can apply it site-wide or limit it to specific membership levels by editing the $restricted_levels array in the code.

It extracts the domain from the entered email, compares it to your list of allowed domains (including support for wildcards like *.school.edu), and displays a helpful message if the domain is not allowed.

Screenshot of an error message showing after a restricted domain was entered during checkout

This solution works across all checkout forms and integrates cleanly with PMPro’s core registration process

The Code Recipe

Update the $valid_domains array to include your organization’s approved domains.

To limit it to specific membership levels, edit the $restricted_levels array.

Adding the Recipe to Your Website

You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.

Video: Coding with Sam Walkthrough

Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics


Was this article helpful?
YesNo