WordPress at Your Fingertips
function is not described

wc_attribute_taxonomy_slug() WC 3.6.0

Get an unprefixed product attribute name.

No Hooks.

Return

String.

Usage

wc_attribute_taxonomy_slug( $attribute_name );
$attribute_name(string) (required)
Attribute name.

Changelog

Since 3.6.0 Introduced.

Code of wc_attribute_taxonomy_slug() WC 5.7.0

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

	if ( $cache_value ) {
		return $cache_value;
	}

	$attribute_name = wc_sanitize_taxonomy_name( $attribute_name );
	$attribute_slug = 0 === strpos( $attribute_name, 'pa_' ) ? substr( $attribute_name, 3 ) : $attribute_name;
	wp_cache_set( $cache_key, $attribute_slug, 'woocommerce-attributes' );

	return $attribute_slug;
}