Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm altering my main wp_query in a pre_get_posts filter in order to improve my site search capabilities.

I've successfully achieved searching in taxonomies, but I fail when it comes to the post date ranges. Even the example query in the wp docs don't work for me.

$datequery = array(
        array(
            'after'     => 'January 1st, 2013',
            'before'    => array(
                'year'  => 2013,
                'month' => 2,
                'day'   => 28,
            ),
            'inclusive' => true,
        ),
    );
$query->set('date_query', $datequery);

If I print_r the content of $wp_query->request, it doesn't contain anything related with dates, except for the ordering.

What's wrong?

PS: WP 3.6.1

share|improve this question
1  
Wrong is your WP version, because date_query will be added only in the WP 3.7 –  Eugene Manuilov Oct 10 '13 at 13:17
add comment

1 Answer

up vote 1 down vote accepted

There is no date_query, not yet, or not in your version of WordPress. From the Codex:

date_query (array) - Date parameters (available with Version 3.7). 

3.7 has not been released, though you can get it via SVN, and you are using 3.6.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.