WC_Brands::get_brand_products_query_args()
Adds the taxonomy query to the WooCommerce products shortcode query arguments.
Method of the class: WC_Brands{}
No Hooks.
Return
Array
.
Usage
$result = WC_Brands::get_brand_products_query_args( $query_args, $attributes, $type );
- $query_args(array) (required)
- -
- $attributes(array) (required)
- -
- $type(string) (required)
- -
WC_Brands::get_brand_products_query_args() WC Brands::get brand products query args code WC 9.5.1
public static function get_brand_products_query_args( $query_args, $attributes, $type ) { if ( 'brand_products' !== $type || empty( $attributes['brand'] ) ) { return $query_args; } $query_args['tax_query'][] = array( 'taxonomy' => 'product_brand', 'terms' => array_map( 'sanitize_title', explode( ',', $attributes['brand'] ) ), 'field' => 'slug', 'operator' => 'IN', ); return $query_args; }