最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp query - Multiple meta_query not returning rows

programmeradmin4浏览0评论

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)

  1. 暂无评论