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'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(); ?>">
    <div>
        <input type="text" id="s" name="s" />
        <input type="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'richwp' ); ?>" />
    </div>
</form>
share|improve this question
1  
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

1 Answer 1

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

 
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.