Actually, I think your code says
Where min_price
>= $price and max_price
<= $price.
Try to switch the operands, like here:
array(
'key' => 'min_price',
'value' => $price,
'compare' => '<=',
'type' => 'NUMERIC'
),
array(
'key' => 'max_price',
'value' => $price,
'compare' => '>=',
'type' => 'NUMERIC'
),
It works for 10.000 and 20.000 since you use the bigger/equal and lower/equal operator.
Related Posts:
- WP_User_Query with meta_query array relation ‘OR’
- User Relationship
- WP_Query ordered by meta_value_num doesn’t fetch posts without this meta field
- WP User Query Issues
- last_name + first_name orderby with meta_query [solved]
- meta query based on month regardless of year
- meta_query in WP_User_Query not working – returns every user, not just users where key & value matches
- Issue with user meta_query
- How to fetch WP_User_Query with multiple role arguments [duplicate]
- Display Users from two roles in one list
- wp_user_query with meta_value_num for leaderboard
- Meta query terribly slow
- meta_query sorting by 2 keys
- How to handle optional end date in compare clause in meta_query
- Query between two meta keys
- How to check a single number value against an array of meta_key values?
- WP_User_Query with combined meta query – not working?
- Meta query with multiple logic (AND / OR)
- Best practice – Meta Query vs. post_clauses for “left join” ordering
- Different page parameters inside query
- LIKE %…% Meta Query
- Multiple Values stored as array in Meta Query
- Documentation for post meta
- Advanced orderby with multiple meta_query
- Very slow query with meta_query on large database
- How to use meta_query to check if a meta field has something set?
- how to create a proper query for getting a list of users with taxonomy related meta key
- meta_query results not the same with and without spaces
- meta_query all posts between to ages
- How to make a WP REST API query with meta_query in WP4.7?
- Nested Queries using meta_query
- WP User Query fails when searching meta queries and search columns
- Use both meta query and tax query
- Wildcard with LIKE operator in Meta query
- Query posts only if meta_value is not empty
- How to pass user meta_key and meta_value (values as array)
- Query Multiple values for same key
- Custom post type archive with rand and meta_value
- Comparing a field with several values at once with meta_query
- Meta query with a sub query group possible?
- meta_query compare=’!=’ with multiple custom fields
- Query posts with numeric meta values within a given range
- meta_query not working on live site
- How do you get Posts by multiple meta_keys and meta_values with the Rest API V2?
- Query custom field with date
- Meta query with regular expression does not work
- Searching in title or meta, with a tax query too!
- WP_Query with meta_query no results
- Documentation for post meta
- Pre Get Posts / Multiple Meta Keys / Orderby Single Key
- Help on multiple meta_query
- Meta query – How to display a null meta key
- WordPress Screwing Up ‘orderby’ => ‘meta_value_num’ in ‘pre_get_posts’
- How to query wp_postmeta table for any specific meta_value?
- User meta query results in PHP notice: only variables should be passed by reference
- meta_query with multiple values optimization
- Get a single post ID based on an exact match of 1 or more meta values
- wordpress Meta_query between numbers range (not working)
- meta_query with multiple key
- Order by meta value
- Extend meta query arguments
- get_posts( $args ) return empty data
- meta query or with meta value
- meta_query array in ‘values’ returns an error
- How do I remove duplicate users from two merged WP_User_Query objects?
- how to search all user meta data that have value like “vivek”
- WP JSON API meta_query not working
- Unable to use meta_query between currency values when value is over 1 million
- Filtering all posts AND sticky posts through meta_query
- How to properly escape values in meta query
- How to cache the results of a query and display the cached results
- How to Ordering by user meta
- How do I echo all users’ display_name and their meta_value who have a certain meta_key?
- How to send variable to wp meta_query value?
- Query users and count totals based on meta values
- Querying terms with calculations based on term meta data, sql vs. get_terms
- get_user can’t read variable
- meta_query check multiple date formats
- Get label in user meta query
- WP_User_Query Orderby Not Working
- Reading Content in an Array as it relates to a meta_query
- Meta_Query with multi select values
- How to sort custom posts including null meta-values in admin columns with meta_query?
- Trouble with calling an imploded variable in an array
- Meta Query returning empty array
- Query for user roles and their skills
- Get Posts from Custom Meta Query
- meta_query for user ID in array
- Display query post based on two orderby value in wordpress
- Search using specific meta fields only (excluding post title and content)
- How to get meta value based on latest post id with group by term name
- Meta query not returning results even though the sql contains the information
- Multiple Queries with meta_query
- Get foreach for meta_query value
- meta_query and strange orderby behaviour
- Sorting not working with get_posts
- order by meta_key [duplicate]
- Meta query with string NOT ending like pattern
- acf/save_post affecting WP_Query results
- Merge meta_value’s into a single row and then loop