add logic for $main_query parameter in get_meta_query
This commit is contained in:
parent
8ed1dacdc9
commit
f5f020e6f4
|
@ -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 ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue