Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active April 6, 2021 22:08
Show Gist options
  • Save andrewlimaza/90f9628e965910064b4e026fdf3d0cdd to your computer and use it in GitHub Desktop.
Save andrewlimaza/90f9628e965910064b4e026fdf3d0cdd to your computer and use it in GitHub Desktop.
hide free level from members and premium level from non-members.
<?php
// Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
function adjusting_the_pmpro_levels_array( $levels ) {
if( !pmpro_hasMembershipLevel() ) {
unset( $levels[1] ); // hide premium level for non-members.
}else{
unset( $levels[2] ); // hide free level for members.
}
return $levels;
}
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