By default, the Member Directory and Profiles Pages Add On includes fields that allow users to opt out of the directory or share their location on a map. But what if you only want specific membership levels to use these features?
This guide shows how to remove the “Show location on map” and “Directory opt-out” fields for specific membership levels. Use it to streamline checkout and profile pages for levels that don’t need directory or map options.
Use this recipe to make directory access a premium feature or to simplify onboarding for certain membership levels.

About the Code Recipe
This recipe uses the pmpro_add_user_field
filter to limit the visibility of specific Member Directory user fields. By adding a levels
property to each targeted field, PMPro will automatically show or hide them based on the current user’s level or level being purchased at checkout.

Step-by-Step Implementation Guide
- Identify Your Member Levels: Visit Memberships > Settings > Levels and make note of the level IDs you want to show the directory/map fields to.
- Add the Code Snippet: Use the Code Snippets plugin or a custom plugin to apply the recipe to your site. Update the
$allowed_levels
array online 23
with the IDs of the membership levels allowed to see these fields. - Test Checkout: Navigate to the Membership Checkout page for a level that should display the map location fields. Confirm that the fields are present. Do the same for a level that should not show the fields and confirm that they are hidden.


- Test Profile Edit: Navigate to the Member Profile Edit page as a member with a level that allows directory opt-out and map location fields. Confirm that the fields are present. Do the same for a level that should not show the fields and confirm that they are hidden.


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
Update the $allowed_levels
array on line 23
with the IDs of the membership levels allowed to see these fields. You can find these IDs on the Memberships > Settings > Levels screen in the WordPress admin.
You can also adjust the code to hide these fields from checkout and only show them on the Member Profile Edit screen by removing the //
to enable line 39
:
$field->profile = 'only';
This setting hides directory fields like Map Opt-in and Map Address at checkout but keeps them available for members to update later in their profile. New members will appear in the directory list but will not show on the map until they edit their profile to opt in and add their location.