We’ve blogged previously about requiring a specific level to allow registration for another level. In that post, the registration check occurs after the user submits the checkout form. This new code gist immediately redirects away from the checkout page if the user’s current membership level is not ID = 1 or is unset.
Again… why would I want to do this?
As I said in the previous post, some membership sites have a specific workflow for membership. For example, if you have a fitness website with phases of training, you’d want to make sure your customers move through your program in the right order.
The Code Recipe
Customize this code with your appropriate membership level IDs and redirect URL. You can repeat lines 11 to 15 with as many registration checks as you need for your membership structure.
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.
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.