Skip to content

Instantly share code, notes, and snippets.

@aaronranard
Created September 20, 2013 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronranard/6643881 to your computer and use it in GitHub Desktop.
Save aaronranard/6643881 to your computer and use it in GitHub Desktop.
WordPress - Blank Search to go to search.php
//For blank searches to use search.php
add_filter( 'request', 'my_request_filter' );
function my_request_filter( $query_vars ) {
if( isset( $_GET['s'] ) && empty( $_GET['s'] ) ) {
$query_vars['s'] = " ";
}
return $query_vars;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment