Cast string to number
WP doesn’t “look” at the type of data you have, it just has a default of CHAR. So if you dump your current query you will see respective type cast: CAST(wp_postmeta.meta_value AS CHAR). To make it work you need to specify type argument explicitly ‘type’ => ‘NUMERIC’ and CAST will change accordingly: CAST(wp_postmeta.meta_value AS SIGNED). … Read more