Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Those instructions are for wordpress 2.5 and don't work with 3.5.1. –  Force Flow Apr 30 '13 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 '13 at 19:07
    
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 '13 at 19:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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