WC_Data_Store_WP::get_term_ids()
Get and store terms from a taxonomy.
Метод класса: WC_Data_Store_WP{}
Хуков нет.
Возвращает
Массив
. of terms
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_term_ids( $object, $taxonomy );
- $object(WC_Data|int) (обязательный)
- WC_Data object or object ID.
- $taxonomy(строка) (обязательный)
- Taxonomy name e.g. product_cat.
Список изменений
С версии 3.0.0 | Введена. |
Код WC_Data_Store_WP::get_term_ids() WC Data Store WP::get term ids WC 8.7.0
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' ); }