adding fix for empty search query
This commit is contained in:
@@ -21,6 +21,17 @@ function roots_search_query($escaped = true) {
|
|||||||
|
|
||||||
add_filter('get_search_query', 'roots_search_query');
|
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
|
// root relative URLs for everything
|
||||||
// inspired by http://www.456bereastreet.com/archive/201010/how_to_make_wordpress_urls_root_relative/
|
// inspired by http://www.456bereastreet.com/archive/201010/how_to_make_wordpress_urls_root_relative/
|
||||||
// thanks to Scott Walkinshaw (scottwalkinshaw.com)
|
// thanks to Scott Walkinshaw (scottwalkinshaw.com)
|
||||||
|
|||||||
Reference in New Issue
Block a user