Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created November 14, 2019 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djrmom/e3c82e1076b9c15e035d13b2bb5a85d8 to your computer and use it in GitHub Desktop.
Save djrmom/e3c82e1076b9c15e035d13b2bb5a85d8 to your computer and use it in GitHub Desktop.
facetwp only wc_query for product post type
<?php
/* only filter woo product query if cpt is product */
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
if ( 'product' == $query->get( 'post_type' ) && 'product_query' != $query->get( 'wc_query' ) ) {
$is_main_query = false;
}
return $is_main_query;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment