Created
March 27, 2012 23:11
-
-
Save tiltos/2221333 to your computer and use it in GitHub Desktop.
WP: Do not allow a blank search
This file contains 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
<?php | |
function make_blank_search ($query){ | |
global $wp_query; | |
if (isset($_GET['s']) && ($_GET['s']=='' || $_GET['s']==' ') ){ | |
wp_redirect( $_SERVER['SERVER_NAME'].'/map', 301 ); exit; | |
} | |
return $query; | |
} | |
add_action('pre_get_posts','make_blank_search'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment