/*
* Remove Category "Featured" form Category List Except Admin.
*/
function remove_category_from_category_list( $categories ) {
if ( is_admin() ) {
return $categories;
}
$removed = array();
foreach ( $categories as $category ) {
if ( $category->name == "Featured" ) {
continue;
}
$removed[] = $category;
}
return $removed;
}
add_filter( 'get_the_categories', 'remove_category_from_category_list' );
Remove Category From WooCommerce Shop Page
/*
* Remove Category "Featured" form Shop Category List.
*/
function exclude_shop_category( $terms, $taxonomies, $args ) {
$new_terms = array();
if ( is_shop() ) {
foreach ( $terms as $key => $term ) {
if ( is_object( $term ) ) {
if ( 'featured' == $term->slug && $term->taxonomy = 'product_cat' ) {
unset( $terms[ $key ] );
}
}
}
}
return $terms;
}
add_filter( 'get_terms', 'exclude_shop_category', 10, 3 );