WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Query::get_tax_query() WC 1.0

Appends tax queries to an array.

Это метод класса: WC_Query

Хуки из метода
Возвращает

Массив.

Использование

$WC_Query = new WC_Query();
$var = $WC_Query->get_tax_query( $tax_query, $main_query );
$tax_query(массив)
Tax query.
По умолчанию: array()
$main_query(true/false)
If is main query.
По умолчанию: false

Код WC Query::get tax query: woocommerce/includes/class-wc-query.php WC 3.9.0

<?php
public function get_tax_query( $tax_query = array(), $main_query = false ) {
	if ( ! is_array( $tax_query ) ) {
		$tax_query = array(
			'relation' => 'AND',
		);
	}

	// Layered nav filters on terms.
	if ( $main_query ) {
		foreach ( $this->get_layered_nav_chosen_attributes() as $taxonomy => $data ) {
			$tax_query[] = array(
				'taxonomy'         => $taxonomy,
				'field'            => 'slug',
				'terms'            => $data['terms'],
				'operator'         => 'and' === $data['query_type'] ? 'AND' : 'IN',
				'include_children' => false,
			);
		}
	}

	$product_visibility_terms  = wc_get_product_visibility_term_ids();
	$product_visibility_not_in = array( is_search() && $main_query ? $product_visibility_terms['exclude-from-search'] : $product_visibility_terms['exclude-from-catalog'] );

	// Hide out of stock products.
	if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) ) {
		$product_visibility_not_in[] = $product_visibility_terms['outofstock'];
	}

	// Filter by rating.
	if ( isset( $_GET['rating_filter'] ) ) { // WPCS: input var ok, CSRF ok.
		$rating_filter = array_filter( array_map( 'absint', explode( ',', $_GET['rating_filter'] ) ) ); // WPCS: input var ok, CSRF ok, Sanitization ok.
		$rating_terms  = array();
		for ( $i = 1; $i <= 5; $i ++ ) {
			if ( in_array( $i, $rating_filter, true ) && isset( $product_visibility_terms[ 'rated-' . $i ] ) ) {
				$rating_terms[] = $product_visibility_terms[ 'rated-' . $i ];
			}
		}
		if ( ! empty( $rating_terms ) ) {
			$tax_query[] = array(
				'taxonomy'      => 'product_visibility',
				'field'         => 'term_taxonomy_id',
				'terms'         => $rating_terms,
				'operator'      => 'IN',
				'rating_filter' => true,
			);
		}
	}

	if ( ! empty( $product_visibility_not_in ) ) {
		$tax_query[] = array(
			'taxonomy' => 'product_visibility',
			'field'    => 'term_taxonomy_id',
			'terms'    => $product_visibility_not_in,
			'operator' => 'NOT IN',
		);
	}

	return array_filter( apply_filters( 'woocommerce_product_query_tax_query', $tax_query, $this ) );
}