I want to know if there is a way to DECIMAL (5,2) instead of DECIMAL in meta_query
1 Answer
Answer taken from here: meta_query: using BETWEEN with floats and/or casting to DECIMAL
add_filter('get_meta_sql','cast_decimal_precision');
function cast_decimal_precision( $array ) {
$array['where'] = str_replace('DECIMAL','DECIMAL(5,2)',$array['where']);
return $array;
}
-
I can't use "meta_query" like this :
'meta_query' => array( array( 'key' => 'color', 'value' => 'blue', 'compare' => 'NOT LIKE' ), array( 'key' => 'price', 'value' => array( 20, 100 ), 'type' => 'numeric', 'compare' => 'BETWEEN' ) )
with get_posts()– OnitaCommented May 18, 2011 at 10:34 -