wc_get_product_term_ids( int $product_id, string $taxonomy )
Retrieves product term ids for a taxonomy.
Description Description
Parameters Parameters
- $product_id
-
(Required) Product ID.
- $taxonomy
-
(Required) Taxonomy slug.
Return Return
(array)
Source Source
File: includes/wc-product-functions.php
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' ); }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |