D
D
Dmitry2018-02-12 16:49:05
WordPress
Dmitry, 2018-02-12 16:49:05

What's wrong with meta_query?

For some reason, the filtering does not work, but the page simply loads endlessly.

$args = array(
    'post_type' => 'catalog',
    'posts_per_page' => 8,
    'meta_query'  => array(
        'relation' => 'OR',
        array(
            'relation' => 'AND',
            array(
                'key'     => 'catalog_presale-start',
                'value'   => $today,
                'compare' => '>=',
            ),
            array(
                'key'     => 'catalog_presale-end',
                'value'   => $today,
                'compare' => '>=',
            ),
        ),
        array(
            'relation' => 'AND',
            array(
                'key'     => 'catalog_tokensale-start',
                'value'   => $today,
                'compare' => '>=',
            ),
            array(
                'key'     => 'catalog_tokensale-end',
                'value'   => $today,
                'compare' => '>=',
            ),
        )
    )
);

$query = new WP_Query($args);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question