wp query – WP_Query returns empty if meta_query has more than 7 values

I think one of your query is not fulfilling the condition. Which condition have you removed to run the query? Last condition ‘by owner’? If so, try the following meta_query

If there is something wrong with the condition then change the relation of the query And To either and check (see). Echo your query and run it in PHPMyAdmin to make sure there are no errors in your query.

$meta_query = array(
        array(
            'key'     => 'payment_status',
            'value'   => 'yes',
        ),
array(
            'key'     => 'expired',
            'value'   => 'no',
        ),
array(
            'key'     => 'listing_type',
            'meta_value_num'   => array(1,2,3),
        ),
array(
            'key'     => 'available_for',
            'value'   => 'sale',
        ),
array(
            'key'     => 'country',
            'value'   => 'Saudi Arabia',
        ),
array(
            'key'     => 'city',
            'value'   => 'Riyadh',
        ),
array(
            'key'     => 'property_type',
            'value'   => 'land',
        ),
                array(
                        'relation' => 'OR',
                        array(
                                'key' => 'by',
                                'value' => 'owner',
                        ),
        ),
);

Leave a Comment