The WordPress search is nice and extensible in many ways except for the option to search with no keywords. Why would you want to do that you ask? Well what if you wanted to search multiple taxonomies at once as a way of drilling down using search criteria with optional keyword as opposed to being forced to use it regardless of relevance.
For instance you might want to search for an event with location, price and age range as taxonomies.. using the WordPress template system this isn’t possible without bodging so you would use the search template to host your own query_posts call to make it happen.
So you use the search form included with most sites and add a taxonomy dropdown or two to get the required fields in there. You submit the form thinking it will go to the search page and then….404. Not good really. This is because unless $_GET['s'] is set and not empty WordPress will not recognise it as a search. This code added to your functions.php file in your theme is a simple way of using the search.php template for any page submitting a form with ‘s’ as a field in the query string (which we can safely assume is a search).
function sb_activate_search() {
if (isset($_GET['s'])) {
include (TEMPLATEPATH . '/search.php');
exit;
}
}
add_action('template_redirect', 'sb_activate_search');



