Remove Uncategorized from widget

function remove_uncategorized_category( $terms, $taxonomy, $query_vars, $term_query ) {
if ( is_admin() )
return $terms; if ( $taxonomy[0] == 'product_cat' ) {
foreach ( $terms as $k => $term ) {
if ( $term->term_id == get_option( 'default_product_cat' ) ) {
unset( $terms[$k] );
}
}
} return $terms;
}
add_filter( 'get_terms', 'remove_uncategorized_category', 10, 4 );

Leave a Reply

Your email address will not be published. Required fields are marked *