• Hello,

    I would like to display some “artworks” with specifics meta key values. Each artworks has a custom field : “votes_average” and another one “votes_count”. This is my custom query :

    $args = array(
        'post_type' => 'artworks',
        'post_status' => 'publish',
        'orderby' => 'meta_value_num',
        'order' => 'DESC',
        'meta_query' => array(
            'relation' => 'AND',
            array(
               'key' => 'votes_average',
               'value' => '6',
               'compare' => '>=',
               'type'    => 'DECIMAL',
            ),
            array(
               'key' => 'votes_count',
               'value' => '1',
               'compare' => '>',
               'type'    => 'NUMERIC',
            ),
        ),
        'tax_query' => array(
            array(
                'taxonomy' => 'type',
                'field' => 'slug',
                'terms' => $term
            )
        )
    );

    I don’t understand why this query display an artwork with an average of 5,8. Did I make a mistake ?

  • The topic ‘Custom meta_query – Display results not expected’ is closed to new replies.