wc_get_attribute_taxonomy_labels()WC 3.6.0

Get (cached) attribute taxonomy label and name pairs.

No Hooks.

Return

Array.

Usage

wc_get_attribute_taxonomy_labels();

Changelog

Since 3.6.0 Introduced.

wc_get_attribute_taxonomy_labels() code WC 8.7.0

function wc_get_attribute_taxonomy_labels() {
	$prefix      = WC_Cache_Helper::get_cache_prefix( 'woocommerce-attributes' );
	$cache_key   = $prefix . 'labels';
	$cache_value = wp_cache_get( $cache_key, 'woocommerce-attributes' );

	if ( false !== $cache_value ) {
		return $cache_value;
	}

	$taxonomy_labels = wp_list_pluck( wc_get_attribute_taxonomies(), 'attribute_label', 'attribute_name' );

	wp_cache_set( $cache_key, $taxonomy_labels, 'woocommerce-attributes' );

	return $taxonomy_labels;
}