Paid Memberships Pro: Hide Levels From the Levels Page
Keeps chosen levels (for example a hidden staff or legacy level) off the public levels page while their checkout links keep working.
Opens WPIDE on
Code
if ( ! function_exists( 'pmpro_getAllLevels' ) ) {
return;
}
// Level IDs to hide.
$wpide_pmpro_hidden_levels = array( 4 );
add_filter( 'pmpro_levels_array', function ( $levels ) use ( $wpide_pmpro_hidden_levels ) {
foreach ( $levels as $key => $level ) {
if ( in_array( (int) ( is_object( $level ) ? $level->id : $key ), $wpide_pmpro_hidden_levels, true ) ) {
unset( $levels[ $key ] );
}
}
return $levels;
} );
Notes
People can still join a hidden level if you give them its checkout link.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.