WC_Template_Loader::unsupported_archive_layered_nav_compatibility()
Add layered nav args to WP_Query args generated by the 'products' shortcode.
Method of the class: WC_Template_Loader{}
No Hooks.
Return
Array
.
Usage
$result = WC_Template_Loader::unsupported_archive_layered_nav_compatibility( $query );
- $query(array) (required)
- WP_Query args.
Changelog
Since 3.3.4 | Introduced. |
WC_Template_Loader::unsupported_archive_layered_nav_compatibility() WC Template Loader::unsupported archive layered nav compatibility code WC 9.3.1
public static function unsupported_archive_layered_nav_compatibility( $query ) { foreach ( WC()->query->get_layered_nav_chosen_attributes() as $taxonomy => $data ) { $query['tax_query'][] = array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $data['terms'], 'operator' => 'and' === $data['query_type'] ? 'AND' : 'IN', 'include_children' => false, ); } return $query; }