Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created February 6, 2020 22:18
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/cd5dfe2ed949fcf33d48f3910eeadec8 to your computer and use it in GitHub Desktop.
Save djrmom/cd5dfe2ed949fcf33d48f3910eeadec8 to your computer and use it in GitHub Desktop.
facetwp woocommerce archive only facets
<?php
/** for sites that only use facets on woocommerce archive pages -
** shop page, product category archives, product tag archives,
** any others auto-created by woocommerce
** not for [product] shortcode or custom queries
**/
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
if ( '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