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.


Top ↑

Return Return

(array) of terms


Top ↑

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' );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.