Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’

May this code help

$args = array(
    'cat' => 'Category id'
    'post_type' => 'post type',
    'meta_key' => 'enter your metakey',
    'orderby' => 'meta_value_num',
    'order' => 'ASC',
    'meta_query' => array(
        array(
           'key' => 'age',
           'value' => array(min price, max price),
           'compare' => 'IN',
       )
    )
);
$query = new WP_Query($args);

$query will contain an Array of post objects.

Reference:

https://codex.wordpress.org/Class_Reference/WP_Query

Leave a Comment