Multiple meta_query not returning rows

Question

I’m trying to add an AND condition to my WP_Query() parameters.

The below query works perfectly and returns all the posts:

$options = array(
    'post_type' => 'available_units',
    'post_status' => 'publish',
    'meta_query' => array(
        'key' => 'reservation_status',
        'value' => 'Reserved',
        '!='
    )
);

However, this one doesn’t:

$options = array(
    'post_type' => 'available_units',
    'post_status' => 'publish',
    'meta_query' => array(
        'relation' => 'AND',
        array(
            'key' => 'reservation_status',
            'value' => 'Available',
            '!='
        ),
        array(
            'key' => 'reservation_request_date',
            'value' => '2020-07',
            'LIKE'
        )
    )
);

I’ve searched for a lot of references online but it seems that my meta_query() snippet is correct. I don’t understand why it’s not returning and data.

0
, ookmnnsocjvpkcbnml 1 year 2020-07-23T02:10:41-05:00 0 Answers 53 views 0

Leave an answer

Browse
Browse