show posts with range meta key

i want to show posts with age between 5 and 10 usind WP_Query.how i can do this?

$args = array(
‘post_type’ => ‘my_custom_post_type’,
‘meta_key’ => ‘age’,
‘orderby’ => ‘meta_value_num’,
‘order’ => ‘ASC’,
‘meta_query’ => array(
array(
‘key’ => ‘age’,
‘value’ => array( 3, 4 ),
‘compare’ => ‘IN’,
),
),);$query = new WP_Query( $args );

Read more here:: show posts with range meta key

Leave a Reply

Your email address will not be published. Required fields are marked *