Created
September 30, 2018 17:22
-
-
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.
This file contains 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
<?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' ); |
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 "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/