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

I recently completed a WordPress site design, and I'm just struggling with one bug: when a user clicks the "Search" button without any content in the text field, they are redirected to a list of posts. Is there a way to modify this action? Ideally, if the text field is empty, the user will be redirected to the homepage.

share|improve this question
up vote 1 down vote accepted

The default WordPress action is to redirect to the homepage when the search is blank - just what you want! Do you have any plugins or .htaccess settings that may be changing this?

share|improve this answer
You're right, thanks very much. I inherited this site from another developer who built the homepage using a template page and didn't include a default index.php file; I've fixed the problem. Thanks! – daysrunaway Jul 30 '11 at 4:29

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.