TransWikia.com

Multiple meta_query not returning rows

WordPress Development Asked by ookmnnsocjvpkcbnml on December 6, 2021

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.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP