WordPress Between Query Not Working Correctly For Numbers?

Is your WordPress between query not displaying the correct results for a numerical numbered integer value at three numbers? All you may need is to set a type.

Get results between two numbers

If you’re having trouble looping through posts that sometimes show results and sometimes don’t with a between meta_compare set, you may be telling the loop to loop between two dates and not numbers.

In order to solve this, you should add a type as per the below example.

$min_value = 150;
$max_value = 300;
$args = array(
     'post_type' => 'example_post_type',
     'posts_per_page' => -1,
     'meta_key' => 'your_meta_key',
     'meta_value' => array( $min_value, $max_value ),
     'meta_compare' => 'BETWEEN',
     'meta_type' => 'NUMERIC'

Note, using type instead of meta_type will work in a meta_query array.