WC_Shortcode_Products::set_tags_query_args()protectedWC 3.3.0

Set tags query args.

Method of the class: WC_Shortcode_Products{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->set_tags_query_args( $query_args );
$query_args(array) (required) (passed by reference — &)
Query args.

Changelog

Since 3.3.0 Introduced.

WC_Shortcode_Products::set_tags_query_args() code WC 9.4.2

protected function set_tags_query_args( &$query_args ) {
	if ( ! empty( $this->attributes['tag'] ) ) {
		$query_args['tax_query'][] = array(
			'taxonomy' => 'product_tag',
			'terms'    => array_map( 'sanitize_title', explode( ',', $this->attributes['tag'] ) ),
			'field'    => 'slug',
			'operator' => $this->attributes['tag_operator'],
		);
	}
}