adding fix for empty search query

This commit is contained in:
Ben Word
2011-11-06 11:03:54 -07:00
parent d01fb43145
commit d7e6994a20

View File

@@ -21,6 +21,17 @@ function roots_search_query($escaped = true) {
add_filter('get_search_query', 'roots_search_query');
// fix for empty search query
// http://wordpress.org/support/topic/blank-search-sends-you-to-the-homepage#post-1772565
function roots_request_filter($query_vars) {
if(isset($_GET['s']) && empty($_GET['s'])) {
$query_vars['s'] = " ";
}
return $query_vars;
}
add_filter('request', 'roots_request_filter');
// root relative URLs for everything
// inspired by http://www.456bereastreet.com/archive/201010/how_to_make_wordpress_urls_root_relative/
// thanks to Scott Walkinshaw (scottwalkinshaw.com)