In both examples, you are searching between 'max'
and 'min'
, where it should be between 'min'
and 'max'
:
array( $dist['max_latitude'], $dist['min_latitude'] )
'value' => $dist['max_latitude'], 'compare' => '>=');
'value' => $dist['min_latitude'], 'compare' => '<=');
Both mean:
“Search for a value that ist greater than max_latitude and less than min_latitude”
Another finding why my own meta_query
didn’t work with geo coordinates: 'type' => 'numeric'
does an SQL CAST()
to SIGNED
. This removes all the decimals of the geo coordinates before comparison!
Related Posts:
- How to do a meta query using REST-API in WordPress 4.7+?
- Get result from meta_query() between two numbers
- Using meta_query on pre_get_posts to exclude a particular meta_key value
- Query between two meta keys
- Archives for custom post type based on a “date” meta value
- get_users meta_query
- meta_query with multiple values
- Return posts with specific meta key first, but the rest in alpha order by last name
- meta_query key value from array
- Order by nested named meta queries with ‘exists’ and ‘not exists’
- Advanced orderby with multiple meta_query
- Arrange Posts By Date In Order Of Closest To The Current Date
- Using get_terms() with meta_query parameters
- WP_User_Query with meta_query array relation ‘OR’
- meta_query problem
- Custom Upcoming Events List for Events Manager Plugin
- How to exlude posts that have certain meta_value?
- User Relationship
- meta_query results not the same with and without spaces
- meta_query all posts between to ages
- WordPress Core – Optimizing meta_query generated SQL?
- Edit post_content on posts with Featured Image
- Display no post when metavalue is 0
- Use both meta query and tax query
- Wildcard with LIKE operator in Meta query
- meta_query, number comparison, not quite working as it should
- Meta Query Compare with Date
- Does meta_query working with value paramater higher then 999?
- meta_query keys and sticky posts
- Custom post type archive with rand and meta_value
- Fastest way to do meta query when I don’t need the actual posts, and just need post_id?
- How to query post only with different excerpt?
- WP_Query with meta_query no results
- Documentation for post meta
- WP User Query Issues
- How to use meta query for greater than value in array?
- Wp Query custom search by meta query
- Filter posts by meta query?
- Help on multiple meta_query
- pre_get_posts and set
- Meta query date column add [x] days to validate
- How to use orderby with meta_query?
- wordpress Meta_query between numbers range (not working)
- Orderby doesn’t work like expected on custom query
- I would like to have add_post_meta to return the ID instead of true or false
- last_name + first_name orderby with meta_query [solved]
- meta query or with meta value
- how to get post meta where value is an array of key value pairs
- Meta Query Based on Month Range
- Find posts by related taxonomy field
- wordpress meta value compare between two date
- Can I use pre_get_posts to add up values from two different meta_keys?
- WP JSON API meta_query not working
- get_users with Serialized Custom Meta Value
- Sorting posts by ACF field
- Ordering custom posts by meta field date
- Unable to use meta_query between currency values when value is over 1 million
- Filtering all posts AND sticky posts through meta_query
- meta_query displays all results and none, my query is wrong
- How to cache the results of a query and display the cached results
- Delete all posts with a specific custom field using meta_query
- Use meta_query in args for relationship
- meta_query Array
- meta_query compare “=“ returns nothing when it seems it should
- How to send variable to wp meta_query value?
- Issue with user meta_query
- How to get an archive page meta?
- Search for value(s) in meta field for a multi select
- How can I create a meta_query with an array of dates?
- How to count items of meta query?
- WordPress meta query with meta serialized data array value
- Reading Content in an Array as it relates to a meta_query
- wordpress meta query with multiple meta condition causing a load on server and slows down the server..!
- Trouble with calling an imploded variable in an array
- Memory Leak in Processing Large JSON file
- Meta Query returning empty array
- meta_query not filering but meta_key works fine
- Query for user roles and their skills
- get posts meta query returning the latest post if no meta key found
- WordPress search between two newmeric values with a custom post type
- like_escape notice when using LIKE in meta query
- meta_query for user ID in array
- Display query post based on two orderby value in wordpress
- WP User Query with meta queries
- WP_Query with UNIX timestamp in meta query
- Querying by meta key and value
- How to compare date in post meta value
- Which Meta Query Compare Method Should I use?
- Sort posts by post views and consider meta key
- Meta query “OR” comparison not working as expected with array
- How to output meta_key in wp_postmeta?
- meta_query and strange orderby behaviour
- Sorting not working with get_posts
- Get_term with meta_query
- WordPress Meta Query very slow with NOT EXISTS comparison
- ACF meta_query field treated as “0” resulting in false negative search when testing ranges
- Is it possible to customize meta query in this way?
- Ordering WP_Query results by second meta_key
- How making a new search box in admin post table working on a specific column
- wp_user_query with meta_value_num for leaderboard