This code recipe gives users a membership level during the frontend WordPress User Registration. You can use this approach if you want to offer the traditional WordPress Registration process or have users register through another plugin’s front end registration, such as BuddyPress or WooCommerce.

The Code Recipe
This code hooks into user_register
and calls the pmpro_changeMembershipLevel
function for the new user. Be sure to change the level id in the code to match the level you want to give.
Note: This approach will not process any membership subscription payments. It will only work if your default membership level is free.
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.
Customize the pmpro_changeMembershipLevel
function in this code with the correct level ID for your default level.