My default search query:


What I want to transform it:


So I added this to my function.php


Works fine for english alphabet but whenever I search a keyword in my language like this:


The title of the page becomes: k%C4%B1rm%C4%B1z%C4%B1 and no results returned.

Let me know if you need more details.

1 Answer 1


This is happening due to encoding. I assume you have a function in your search page, which you get and use search_text inside that template. You should decode the URL before doing so.

The urldecode() function would be what you are looking for. Your string is also UTF-8 encoded, so this is what you are going to need:

$string = utf8_decode( urldecode( $_GET['search_text'] ) );

Now you can use the decoded string in your search.

  • Your response showed me the way, I don't take search_text from $_GET, but using get_query_var. So the following alone worked for me: urldecode( get_query_var('search_text') ) ;
    – HOY
    Aug 9, 2017 at 23:08
  • 1
    I didn't have access to your code, so that was a total guess. Glad to see you've found the cure for the problem :)
    – Johansson
    Aug 9, 2017 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.