UPDATE:
Sorry, apparently my solution faces the same problem when the query contains values such as ‘$599,000’ or ‘$1,149,000.
so far, the only solution so far was cleaning the database imported data values to INT/UNSIGNED (even though, meta_value is saved as TEXT).
However, the meta ordering by value still don’t work quite as it should.
Original suggestion:
Working with real state properties search by value I’ve faced the same problem.
I was able to fix this very same issue using compare type CHAR and separating my meta query args as follow:
$meta_query = array();
if ($_GET['min'] && $_GET['max']) {
$meta_query[] = array(
'key' => 'value',
'value' => '$'.$_GET['min'], // PREPEND '$' TO COMPARE STRINGS IN "$2.000.000,00" BRL FORMAT
'type' => 'CHAR',
'compare' => '>=',
);
$meta_query[] = array(
'key' => 'valor',
'value' => '$'.$_GET['max'],
'type' => 'CHAR',
'compare' => '<=',
);
}
Then build the rest of my query:
$args = array(
'numberposts' => -1,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => $meta_query,
'post_type' => 'imovel',
'suppress_filters' => true,
);
if ($_GET['cod']) {
$args['title'] = $_GET['cod'];
}
// dump_die($args);
$posts = get_posts($args);