…= date( ‘d’, $time ); $date_query = array( ‘month’ => $month, ‘day’ => $day, ); if ( $use_year ) { $date_query[‘year’] = $year; } $query->set( ‘date_query’, $date_query ); $query->query_vars[‘s’] = ”; } return $query; } The solution is simple. The search query ($query->query_vars[‘s’]) is fed to PHP’s strtotime() function, which…I just wanted to be able to type in a date on the search and for the search to come up with all the blog posts for that date. This is one of those tasks that sounds really simple, but is actually complicated. However, this question piqued my interest and……converts an English-language string to a timestamp. If the search query converts to a timestamp, the timestamp is converted into a date and used for a date query. The function also checks if the year appears in the query. If it doesn’t, the year isn’t used. Yearless dates are converted…
1 Comment. Leave new
thank you for the quick reaction. fortunately I remembered I updated relevanssi and concluded the mess on the site was caused by 2.9.2.
best regards
fmh