When you add user fields to your membership checkout, Paid Memberships Pro blocks the form from submitting until all required fields are filled in. When a member edits their profile page, however, PMPro allows profile saves to go through even when required fields are empty. That is by design because blocking the save would discard any other changes the member had already made to their profile.

If your site does need to block the profile form from saving to enforce required fields, then this recipe will show you how.

Featured Image for Require User Fields on the Member Profile Edit Page

Do You Need This Recipe?

PMPro’s default behavior when editing the Member Profile page is intentional. Blocking the form means members lose all other changes they entered, not just the missing required field. Before adding this recipe, consider whether that trade-off fits your members’ experience.

This recipe is worth adding if:

  • You collect a required field (phone number, company name, or a custom user field) that your site depends on and cannot be left blank after initial signup.
  • Your member data feeds into a CRM, integration, or reporting system that breaks when the field is empty.
  • Your members understand that certain fields cannot be skipped on the profile page, so strict validation will not come as a surprise.

If you would prefer not to use code, the Force Profile Completion Add On enforces required User Fields automatically and also redirects members until their profile is complete.

Best Practices and Considerations

All changes are discarded on error. When a required field is empty and an error is triggered, the entire profile save is blocked. The member’s other changes are also lost. They have to re-enter everything.

Admin-side edits are not affected. This code does not restrict profile updates made through the WordPress admin (Users > All Users > Edit). It only applies to the frontend Profile page when editing.

About the Code Recipe

The pmpro_user_profile_update_errors action fires when the member’s profile form is submitted, before any data is saved. Your callback receives three arguments:

  • $errors (array, passed by reference): A list of error message strings.
  • $update (bool): Whether the operation is an update. This is always true on the member’s profile page.
  • $user (WP_User, passed by reference): The user object being updated.

If $errors is empty when the action finishes, the profile saves normally. If it contains any strings, the save is blocked and PMPro displays each error to the member.

Both the $errors and $user parameters are passed by reference. The & in the function signature is required. Without it, changes to $errors inside your function will not carry back to PMPro’s save routine and validation will silently do nothing.

Screenshot of when you're editing your profile page and you leave a required field empty, it will display the error from the code recipe and block submission.

The Code Recipe

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.

How to Customize This Code Recipe

  • Require a different field. Replace the first_name part on line 21 with the meta key of the field you want to require. For PMPro user fields, the meta key is the Field Name set when you created the field under Memberships > Settings > User Fields. For default WordPress user fields, common meta keys include last_nameuser_email, and display_name.
  • Customize the error message. Replace the 'Please enter a first name.' text on line 22 with the message you want to display when that field is empty.
  • Require multiple fields. Add an additional if ( empty( $_REQUEST['your_field_name'] ) ) block (copy lines 21-23) for each field. Update the meta key and error message for each additional field. Each missing field displays its own separate error message.


Was this article helpful?
YesNo

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