Skip to content

Instantly share code, notes, and snippets.

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 icetee/aa14b40c759d60d791c6 to your computer and use it in GitHub Desktop.
Save icetee/aa14b40c759d60d791c6 to your computer and use it in GitHub Desktop.
Esconde categorias do painel
<?php
function the_category_filter($thelist,$separator=' ') {
if(!defined('WP_ADMIN')) {
$exclude = array('A', 'B', 'C', 'D'); //as categorias para esconder
$cats = explode($separator,$thelist);
$newlist = array();
foreach($cats as $cat) {
$catname = trim(strip_tags($cat));
if(!in_array($catname,$exclude))
$newlist[] = $cat;
}
return strip_tags(implode($separator,$newlist));
} else {
return $thelist;
}
}
add_filter('the_category','the_category_filter', 10, 2);
;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment