Skip to content

Instantly share code, notes, and snippets.

@cyberwani
Forked from strangerstudios/my_pmpro_hidden_levels
Created February 19, 2014 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyberwani/9089723 to your computer and use it in GitHub Desktop.
Save cyberwani/9089723 to your computer and use it in GitHub Desktop.
<?php
/*
Hide Levels on Levels Page
Adjust this code to your needs (change $levels_hide) and
add this to your active theme's functions.php or a custom WordPress plugins.
*/
function my_pmpro_levels_array($levels)
{
//here is where you define the levels to hide based on level id
$levels_hide = array(1,3,2,4);
//loop through $levels_order array and pull levels from $levels
$new_levels = array();
foreach($levels_hide as $level_id)
{
foreach($levels as $key => $level)
{
if($level->id == $level_id)
{
unset($levels[$key]);
break;
}
}
}
//returning our altered array
return $new_levels;
}
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