Skip to content

Instantly share code, notes, and snippets.

@Xtremefaith
Last active August 29, 2015 13:57
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 Xtremefaith/9615334 to your computer and use it in GitHub Desktop.
Save Xtremefaith/9615334 to your computer and use it in GitHub Desktop.
Want to redirect a user who enters a blank search request, here is a snippet to help with that.
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