WordPress at a glance
function is not described

_wc_get_cached_product_terms() WC 3.0.0

Cached version of wp_get_post_terms(). This is a private function (internal use ONLY).

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.


Array. Nothing.


_wc_get_cached_product_terms( $product_id, $taxonomy, $args );
$product_id(int) (required)
Product ID.
$taxonomy(string) (required)
Taxonomy slug.
Query arguments.


Since 3.0.0 Introduced.

Code of _wc_get_cached_product_terms() WC 5.2.2

function _wc_get_cached_product_terms( $product_id, $taxonomy, $args = array() ) {
	$cache_key   = 'wc_' . $taxonomy . md5( wp_json_encode( $args ) );
	$cache_group = WC_Cache_Helper::get_cache_prefix( 'product_' . $product_id ) . $product_id;
	$terms       = wp_cache_get( $cache_key, $cache_group );

	if ( false !== $terms ) {
		return $terms;

	$terms = wp_get_post_terms( $product_id, $taxonomy, $args );

	wp_cache_add( $cache_key, $terms, $cache_group );

	return $terms;