📅  最后修改于: 2022-03-11 14:54:39.447000             🧑  作者: Mango
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ($terms as $term) {
$product_cat_id = $term->term_id;
break;
}