WC_Data_Store_WP::get_term_ids( WC_Data|integer $object, string $taxonomy )
Get and store terms from a taxonomy.
Description Description
Parameters Parameters
- $object
-
(Required) WC_Data object or object ID.
- $taxonomy
-
(Required) Taxonomy name e.g. product_cat.
Return Return
(array) of terms
Source Source
File: includes/data-stores/class-wc-data-store-wp.php
protected function get_term_ids( $object, $taxonomy ) {
if ( is_numeric( $object ) ) {
$object_id = $object;
} else {
$object_id = $object->get_id();
}
$terms = get_the_terms( $object_id, $taxonomy );
if ( false === $terms || is_wp_error( $terms ) ) {
return array();
}
return wp_list_pluck( $terms, 'term_id' );
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |