0
<form class="search-form" action="<?php echo home_url( '/suche/' ); ?>" method="get">

    <input type="text" name="s" class="s" value="<?php the_search_query(); ?>" />

this is in my searchform.php template.

Any ideas why when searching for e.g. "Graphic Design" it searches for "Cool%20Car" and replaces the space with an encoded %20?

This of course doesn't return any results because there is no text as "Cool%20Car" on my blog.

Any idea how to fix that?

1
  • You could change the 'method' to POST... Commented Oct 12, 2012 at 0:55

1 Answer 1

2

This happens because search strings gets url encoded in order for the URL to be valid. You can reverse this with urldecode.

5
  • But this seems weird. Has never happened to me on other Wordpress Sites I made. Or at least it worked with the search terms. In my case the search.php holds Cool%20Car as term and not Cool Car as it's supposed to. I know the url must be encoded but why are the terms on my search.php site still encoded? Commented Oct 6, 2012 at 14:54
  • As usual - try to deactivate all plugins, and switch to default theme. If it doesn't happen there then there is something with your plugins/theme and then turn them on one by one and see which one gives u problems.
    – Miha Rekar
    Commented Oct 6, 2012 at 17:07
  • It's not fault of any plugins as it seems. Any other idea what could cause that? Commented Oct 8, 2012 at 6:43
  • What about theme?
    – Miha Rekar
    Commented Oct 8, 2012 at 6:46
  • Well, the only functions that could have anything to do with this are those … cl.ly/code/121u2I2F2X2K However I tried to comment-out them one by one and it didn't make a difference. And as you can see of course the search-form.php template that is posted above in my question. Commented Oct 8, 2012 at 15:05

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.