Created
June 22, 2021 07:21
-
-
Save plugin-republic/7b322e7f904f601a3c8100db89b404bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add different product types | |
*/ | |
function prefix_ptuwc_query_product_type( $tax_query, $args, $table ) { | |
$product_types = array( 'grouped' ); // Add your custom post types here as a comma separated list | |
if( $tax_query ) { | |
foreach( $tax_query as $index=>$arg ) { | |
if( isset( $arg['taxonomy'] ) && $arg['taxonomy'] == 'product_type' ) { | |
// Check the taxonomy given | |
$tax_query[$index]['terms'] = array_merge( $tax_query[$index]['terms'], $product_types ); | |
} | |
} | |
} | |
return $tax_query; | |
} | |
add_filter( 'ptuwc_query_tax-query', 'prefix_ptuwc_query_product_type', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment