wc_get_product_term_ids()WC 3.0.0

Retrieves product term ids for a taxonomy.

Хуков нет.

Возвращает

Массив.

Использование

wc_get_product_term_ids( $product_id, $taxonomy );
$product_id(int) (обязательный)
Product ID.
$taxonomy(строка) (обязательный)
Taxonomy slug.

Список изменений

С версии 3.0.0 Введена.

Код wc_get_product_term_ids() WC 8.7.0

function wc_get_product_term_ids( $product_id, $taxonomy ) {
	$terms = get_the_terms( $product_id, $taxonomy );
	return ( empty( $terms ) || is_wp_error( $terms ) ) ? array() : wp_list_pluck( $terms, 'term_id' );
}