Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created February 5, 2014 17:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save strangerstudios/8828721 to your computer and use it in GitHub Desktop.
Save strangerstudios/8828721 to your computer and use it in GitHub Desktop.
my_pmpro_hidden_levels
<?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