Last active
September 2, 2015 14:05
-
-
Save palicko/da27f9a60bf9667df261 to your computer and use it in GitHub Desktop.
redirect to url like http://your-site.com/search/searchterm
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 search_url_rewrite_rule() { | |
if ( is_search() && !empty($_GET['s'])) { | |
wp_redirect(home_url("/search/") . urlencode(get_query_var('s'))); | |
exit(); | |
} | |
} | |
add_action('template_redirect', 'search_url_rewrite_rule'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment