WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is this possible? I have a searchform that searches for certain categories. If there is no post, it will show me a 404 page... Can I change this page to something else? If so, how do I do that?

share|improve this question
Seems like the actual problem is not the template but the empty search. Just marked it for others to check. – kaiser Aug 4 '13 at 11:39

You can either change the code of your 404.php to conditionally show other stuff with is_search() { ... } or you can use the search.php Template.

share|improve this answer
What difference will is_search make? It does not get my category? How do I do that? – user1627363 Aug 4 '13 at 11:18
It's a conditional tag and it allows you to check if you got a search results page. – kaiser Aug 4 '13 at 11:37
Ah, so the is_search goes in the place where I want a different output? Well then, I guess I have to try that. Thanks. – user1627363 Aug 4 '13 at 11:41
I tried this in 404.php, but it did nothing <?php if (is_search() { echo 'blabla'; });?> What is wrong with this one? – user1627363 Aug 4 '13 at 15:23
Have you read the other Q/A I linked in the comment to your answer? – kaiser Aug 4 '13 at 16:04

Your Answer


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.