[wp-trac] [WordPress Trac] #18485: Search with blank criteria returns results in wrong template file.
WordPress Trac
wp-trac at lists.automattic.com
Fri Aug 19 14:34:44 UTC 2011
#18485: Search with blank criteria returns results in wrong template file.
--------------------------+------------------------------
Reporter: baderatw | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Awaiting Review
Component: Template | Version: 3.2.1
Severity: major | Resolution:
Keywords: |
--------------------------+------------------------------
Comment (by SergeyBiryukov):
!WordPress prefills all query vars (including `s`) with empty values, so
that's probably by design.
A workaround might look like this:
{{{
function load_search_template_for_blank_criteria() {
global $wp_query;
if ( isset( $_GET['s'] ) )
$wp_query->is_search = true;
}
add_action('template_redirect',
'load_search_template_for_blank_criteria');
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18485#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list