From f5f020e6f489162b1c0fe6a5dc67d5a55fad6ab7 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Thu, 31 Jan 2019 11:15:14 -0400 Subject: [PATCH] add logic for $main_query parameter in get_meta_query --- includes/class-wc-query.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/class-wc-query.php b/includes/class-wc-query.php index e60979b2d98..353877554bf 100644 --- a/includes/class-wc-query.php +++ b/includes/class-wc-query.php @@ -598,10 +598,14 @@ class WC_Query { * @return array */ public function get_meta_query( $meta_query = array(), $main_query = false ) { + global $wp_query; + if ( ! is_array( $meta_query ) ) { $meta_query = array(); } - $meta_query['price_filter'] = $this->price_filter_meta_query(); + if ( $main_query || $wp_query === self::$product_query ) { + $meta_query['price_filter'] = $this->price_filter_meta_query(); + } return array_filter( apply_filters( 'woocommerce_product_query_meta_query', $meta_query, $this ) ); }