How to set wp_query on search page in wordpress
<p>We have search page, that is using standart global $wp_query and takes parameters like s and category_name from $_GET.</p>

<p>I want to add some parameters in wp_query on search page. But more complicated than parameters passed in $_GET. </p>

<p>That's why I tried to create new WP_Query like</p>

<pre><code>$args = array(
'date_query' =&gt; array(
    array(
        'hour'      =&gt; 9,
        'compare'   =&gt; '&gt;=',
    ),
    array(
        'hour'      =&gt; 17,
        'compare'   =&gt; '&lt;=',
    ),
    array(
        'dayofweek' =&gt; array( 2, 6 ),
        'compare'   =&gt; 'BETWEEN',
    ),
),
'posts_per_page' =&gt; -1,
);

$new_query = new WP_Query($args);
</code></pre>

<p>And take results in </p>

<pre><code>&lt;?php while ($new_query-&gt;have_posts()) : $new_query-&gt;the_post(); ?&gt;
</code></pre>

<p>But it doesn't work. Even if to reset global $wp_query with </p>

<pre><code>wp_reset_query()
</code></pre>

<p>I can rewrite global $wp_query going inside and compare date of every post with my date and to unset post if doesn't match. But I am shure it is not right way to do what I want.</p>

<p>What am I dooing wrong?</p>