Last active
October 19, 2020 14:34
-
-
Save mgibbs189/00ccc6c95e00272111e39803324aaf80 to your computer and use it in GitHub Desktop.
FacetWP - ignore WC REST API queries
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 to your (child) theme's functions.php | |
// woocommerce_rest_{$this->post_type}_object_query | |
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) { | |
if ( false !== strpos( $_SERVER['REQUEST_URI'], 'wp-json/wc/v3' ) ) { | |
$is_main_query = false; | |
} | |
return $is_main_query; | |
}, 10, 2 ); | |
/* | |
add_filter( 'woocommerce_rest_product_object_query', function( $args ) { | |
$args['facetwp'] = false; | |
return $args; | |
}); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment