I found this snippet online …
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');
This transforms my ?/s=term
into /search/term
which is almost what I want.
I'd like to use the german word "suche" instead of "search" inside my permalinks.
I thought of changing home_url("/search/")
to simply home_url("/suche/")
but that doesn't work.
How can I make that happen?