I'm having some difficulty comparing between a negative and positive number. This code works fine when it's between two positive numbers but not when it's between a negative then a positive one.
This is part of my 'meta_query':
array_push($metaQuery,
array('relation' => 'AND',
array(
'key' => 'longitude',
'value' => array($minlng, $maxlng),
'compare' => 'BETWEEN',
),
)
);
If for instance the $minlng is -1.5 and the $maxlng is 1.5. It will pass through values that equal -3.
Here is a var_dump of the meta_query if that is a help:
array(1) {
[0]=>
array(2) {
["relation"]=>
string(3) "AND"
[0]=>
array(3) {
["key"]=>
string(9) "longitude"
["value"]=>
array(2) {
[0]=>
float(-0.989505008087)
[1]=>
float(1.31257480809)
}
["compare"]=>
string(7) "BETWEEN"
}
}
}
"type" => "NUMERIC"
codex.wordpress.org/Class_Reference/…"type" => "NUMERIC"
???? Isn't it obvious that if you'd use between you'll want to use numeric values by default? Half a day is gone because of that.