Created
February 17, 2017 15:02
-
-
Save strangerstudios/eeb697774fb59be4412186f470c88d28 to your computer and use it in GitHub Desktop.
Use pmpro_levels_array filter to hide specific (in this level ID 1) levels.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_pmpro_levels_array($levels) | |
{ | |
//a comma-separated list of the levels to hide | |
$hiddenlevels = array(1); | |
//build the filtered levels array | |
$newlevels = array(); | |
foreach($levels as $key => $level) { | |
if( !in_array( $level->id, $hiddenlevels ) ) { | |
$newlevels[$key] = $level; | |
} | |
} | |
return $newlevels; | |
} | |
add_filter( 'pmpro_levels_array', 'my_pmpro_levels_array' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "How to Design Your Membership Levels Page: Custom Order, Dynamic List, Hide the Display, or Skip it Mega Post" at Paid Memberships Pro here: https://www.paidmembershipspro.com/memberships-levels-page-order-hide-display-skip-mega-post/