I have a WP_Query with meta_query filter on meta_value.
if( ($capacity != '') && ($capacity > 0) ) $filters[] = array('key' => 'mb_capacity','compare' => '>','value' => $capacity, 'type' => 'NUMERIC');
and then later i set the 'meta_query' => $filters of the query
The custom field mb_capacity represents an number but WP store it as a String. I was thinking the "type=>'numeric'" option will handle that, but unfortunatly it doesn't work, the comparison still be done on String instead of Integer.
Is there any solution to that problem ?
Note that i'm using WP 3.2.1.
Many thanks for any suggestions
'type' => 'NUMERIC'part causes the meta_value to be cast to a number in SQL:CAST(wp_postmeta.meta_value AS SIGNED), before being compared. – Geert Dec 8 '11 at 15:09