Last active
December 12, 2015 15:20
-
-
Save eltondev/c8c539ff631c1daad654 to your computer and use it in GitHub Desktop.
Redirect page if search not found
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SearchFilterNull($query) { | |
if (isset($_GET['s']) && empty($_GET['s']) && $query->is_main_query()){ | |
$query->is_search = true; | |
$query->is_home = false; | |
} | |
return $query; | |
} | |
add_filter('pre_get_posts','SearchFilterNull'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment