WC_Widget_Layered_Nav::get_instance_taxonomy()protectedWC 1.0

Get this widgets taxonomy.

Method of the class: WC_Widget_Layered_Nav{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_instance_taxonomy( $instance );
$instance(array) (required)
Array of instance options.

WC_Widget_Layered_Nav::get_instance_taxonomy() code WC 9.4.2

protected function get_instance_taxonomy( $instance ) {
	if ( isset( $instance['attribute'] ) ) {
		return wc_attribute_taxonomy_name( $instance['attribute'] );
	}

	$attribute_taxonomies = wc_get_attribute_taxonomies();

	if ( ! empty( $attribute_taxonomies ) ) {
		foreach ( $attribute_taxonomies as $tax ) {
			if ( taxonomy_exists( wc_attribute_taxonomy_name( $tax->attribute_name ) ) ) {
				return wc_attribute_taxonomy_name( $tax->attribute_name );
			}
		}
	}

	return '';
}