Home / functions.php / Rewrite the search results slug to /search/term
  • Anonymous

    Is there some SEO advantage by using this instead of the default URL?
    Nice function BTW, i’ll use it.

    • To be honest I don’t think it is that big of a help to SEO however if you have pretty links enabled this continues this look rather then ?s= .

  • Thanks for the snipp, but there is a problem when you try to search words with accents (á, é, í, ó, ú) or others letters (ñ, ç, …)

    You have to decode the search term in the query_vars and in the search_query. Here is my code

    function you_search_filter($s) {
    return urldecode($s);

    add_filter(‘get_search_query’, ‘you_search_filter’);

    add_filter(‘the_search_query’, ‘you_search_filter’);

    add_action(‘parse_query’, ‘you_query_vars_search_filter’ );

    function you_query_vars_search_filter( $qvars ) {
    $qvars->query_vars[‘s’] = urldecode($qvars->query_vars[‘s’]);
    return $qvars;


    Hope it could be useful