Changing search slug from + to – (hyphen)
PHP’s urlencode() function replaces spaces with +s, so that’s why that’s happening for you. WordPress provides the sanitize_title() function, which is used (among other things) to generate a post slug from the post’s title. /** * Change search page slug. */ function wp_change_search_url() { if ( is_search() && ! empty( $_GET[‘s’] ) ) { wp_redirect( … Read more