WC_API_Products::get_attribute_taxonomy_by_slug()
Get attribute taxonomy by slug.
Method of the class: WC_API_Products{}
No Hooks.
Return
String|null
.
Usage
// private - for code of main (parent) class only $result = $this->get_attribute_taxonomy_by_slug( $slug );
- $slug(string) (required)
- -
Changelog
Since 2.2 | Introduced. |
WC_API_Products::get_attribute_taxonomy_by_slug() WC API Products::get attribute taxonomy by slug code WC 7.7.0
private function get_attribute_taxonomy_by_slug( $slug ) { $taxonomy = null; $attribute_taxonomies = wc_get_attribute_taxonomies(); foreach ( $attribute_taxonomies as $key => $tax ) { if ( $slug == $tax->attribute_name ) { $taxonomy = 'pa_' . $tax->attribute_name; break; } } return $taxonomy; }