admin管理员组

文章数量:1328034

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.

本文标签: wp queryMultiple metaquery not returning rows