Date query breaking query_posts in ajax

150 Views Asked by At

I am trying to run a query that gets its variables passed via ajax.

Without the date_query, it works fine, but with it added it seems to break the query

the idea is to give the user a option to filter by date

$date =  strtotime($_POST["date"]);
        $myquery = array(
            'tax_query' => array(
                array(
                    'taxonomy' => 'language',
                    'terms' => $lang,
                    'field' => 'slug',
                ),
                array(
                    'taxonomy' => 'region',
                    'terms' => $region,
                    'field' => 'slug',
                ),
                array(
                    'taxonomy' => 'category',
                    'terms' => $category,
                    'field' => 'slug',
                )
            ),
            'date_query' => array(
                    'year' => date('Y', $date),
                    'month' => date('m', $date),
                    'day' => date('d', $date),
            )
        );
    wp_reset_query();

    query_posts($myquery);;
0

There are 0 best solutions below