add logic for $main_query parameter in get_meta_query

This commit is contained in:
Ron Rennick 2019-01-31 11:15:14 -04:00
parent 8ed1dacdc9
commit f5f020e6f4
1 changed files with 5 additions and 1 deletions

View File

@ -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 ) );
}