Nothing entered in search results in display of 'home', fix presented #97

elimc opened this Issue Oct 31, 2012 · 1 comment

2 participants


When someone enters nothing into the search field, the user is redirected to the 'home' page.

See issue here along with fix:

Code to add to the functions file to fix issue:

 * When user enters nothing in search, my_request_filter returns list of posts
 * @link
 * @param string $query_vars
 * @return string
function my_request_filter( $query_vars ) {
    if( isset( $_GET['s'] ) && empty( $_GET['s'] ) ) {
        $query_vars['s'] = " ";
    return $query_vars;
add_filter( 'request', 'my_request_filter' );

The above code will still allow the search to perform its normal duties. It only fixes things when the search form is empty.

Thoughts on this technique?


This is what I would consider to be an issue best handled by core.

There is a ticket here:

Closing this as wontfix.

@mfields mfields closed this Nov 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment