Skip to content

Instantly share code, notes, and snippets.

@pbrocks
Created September 30, 2018 17:22
Show Gist options
  • Save pbrocks/3cda115b1438d141a2de1335db5ac1fe to your computer and use it in GitHub Desktop.
Save pbrocks/3cda115b1438d141a2de1335db5ac1fe to your computer and use it in GitHub Desktop.
The `pmpro_levels_array` gives you the opportunity to adjust how your Levels array winds up being output to screen.
<?php // Do not include in Customizations plugin
/**
* pmpro_levels_array This filter allows us to alter what winds up as the Levels array
*
* @param array $levels The array created in admin
*
* @return array Output of the array
*/
function adjusting_the_pmpro_levels_array( $levels ) {
$newlevels = array();
foreach ( $levels as $level ) {
if ( ! pmpro_isLevelFree( $level ) ) {
$newlevels[] = $level;
}
}
return $newlevels;
}
add_filter( 'pmpro_levels_array', 'adjusting_the_pmpro_levels_array' );
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Hide Free Levels From the Membership Levels Page" at Paid Memberships Pro here: https://www.paidmembershipspro.com/hide-free-levels-from-the-membership-levels-page/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment