I built a custom theme, and in it, there is a 404.php page and a search.php page.

Elsewhere in the template, I wanted to link to the search page directly. So, I used the get_search_template() function to get the search page link, which results in a link like this: http://example.org/search

When I click the link, I get sent to the 404 page template.

Why is it going to the 404 page template instead of the search page template?

1 Answer 1


Confusingly WordPress does not have a concept of a simply search page, it only has concept of search results page. The difference is critical because search without search query 404s as you are seeing.

If you want dedicated search page you would have to implement it as custom one, see Codex > Creating a Search Page.

  • 1
    Those instructions are for wordpress 2.5 and don't work with 3.5.1.
    – Force Flow
    Apr 30, 2013 at 19:02
  • Elaborate by updating your question or asking new one? It might be outdated in details, but it seems fine to me conceptually.
    – Rarst
    Apr 30, 2013 at 19:07
  • 2
    Details matter ;) Anyway, I was able to figure it out. The template page needs to be named page-search.php. A page named "Search" must be created in the wordpress dashboard.
    – Force Flow
    Apr 30, 2013 at 19:09

Your Answer

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

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