Untitled
unknown
php
2 years ago
321 B
6
Indexable
function my_get_category( $id ) { $term = get_terms( array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'meta_query' => array( array( 'key' => '_category_id', 'value' => $id, 'compare' => '=' ) ) ) ); if ( ! empty( $term ) ) { return $term[0]->slug; } }
Editor is loading...