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've customized a theme and am having some problems with search results using multiple-word queries. Site is live at www.abetterworldbydesign.com

Searching for a single word works as expected.

Searching for multiple words that should have returned results shows blank results.

Oddly enough, manually changing the "+" character in the URL to "&" displays the results correctly but only shows the first word in the header "Search results for:_".

My code in search.php for initializing WP_Query follows exactly the code listed in the codex. Full code for search.php on pastebin.

Code for searchform.php below.

<form id="searchform" name="searchform" method="get" action="<?php echo home_url(); ?>">
        <input type="text" id="s" name="s" />
        <input type="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'richwp' ); ?>" />
share|improve this question
Pretty sure the correct way to search for multiple words is with a +, anything you add on with an & will get treated as a seperate query paramter. I'm not 100% sure though.. been a while since i've examined the search code. – t31os Jul 26 '11 at 15:06
up vote 0 down vote accepted

Answer from Richard M on the question originally asked on StackOverflow:

Replacing line 21 on search.php with $search_query[$query_split[0]] = urldecode($query_split[1]) resolved it.

share|improve this answer

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.