Not every membership level on your site is meant for public signup. You might have a free trial level created for testing, a legacy level some members were grandfathered into, or a level that only gets assigned through the backend. When levels like these sit next to your paid options on the Membership Levels page, they clutter the signup experience and can confuse potential members.

This code recipe filters which levels appear on the Membership Levels page, hiding every free level automatically so members only see the levels you are actively selling.

Hide Free Levels From the Membership Levels Page

Do You Need This Recipe?

This recipe is a good fit if:

  • You have one or more free levels that exist for a specific purpose (a trial, an internal test level, a legacy level) and do not want them shown as a signup option.
  • You want the Membership Levels page to show only the levels you are actively selling, without deleting or deactivating the free levels.

If every level on your site is one you want members to see and select, you do not need this recipe.

About the Code Recipe

This recipe uses the pmpro_levels_array filter, which PMPro runs on the array of levels right before it displays them on the Membership Levels page. Your callback receives the levels array and returns a filtered array. Whatever you return is what members see and can select from.

It uses PMPro’s pmpro_isLevelFree() function to check each level and remove any level with no cost, so every free level disappears automatically, including ones you add later.

Note: This recipe hooks pmpro_levels_array, so it hides matching levels everywhere PMPro runs that filter, not only on the default Membership Levels page. This includes the [membershiplevels] shortcode even when you pass specific level IDs to it, the Membership Levels block, and the pricing table block from the Advanced Levels Page Add On. If a level is free, it is removed from those displays too, regardless of how the levels were selected to appear there.

Membership Levels page showing only paid levels after free levels 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

  • Hide levels by a condition other than price (line 24): Replace the pmpro_isLevelFree( $level ) check with your own logic, such as checking a custom field saved on the level. For example, if you save a checkbox meta value under the key hide_from_levels_page for each level, replace the check with get_pmpro_membership_level_meta( $level->id, 'hide_from_levels_page', true ).



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