My goal here is to query posts by a meta_key, with the values falling in between 1-100. When pulled, it is suppose to be ordered by ascending starting from 1 to 100.
$post = array(
'posts_per_page' => 10,
'post_type' => 'post',
'tax_query' => array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'category-1'
),
'meta_query' => array(
'meta_key' => 'custom-key',
'meta_value' => array(1,100),
'meta_compare' => 'BETWEEN'
),
'order' => 'ASC',
'orderby' => 'meta_value_num',
);
When looking at the page, it works of getting posts w/ meta-values '1-100', but it is not ordering correctly. It looks random (i.e. 1, 21, 5, 20, 6, 7, 8 , 3, 9, 19) saying in this order even when the page is constantly refreshed.
Any help will be appreciated.
Thanks!