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

Recently our site began no longer returning correct search results. When searching it returns one result that's unrelated to the inquiry. I've turned off all plugins and reverted back to a day when I thought it was working properly to no avail. What could possibly cause this to occur?

You can see in the image below that the result is not related to the inquiry. enter image description here

Here's an example of a page with the title and terms related to the inquiry. enter image description here

The front end also returns inaccurate resultsenter image description here

share|improve this question
up vote 1 down vote accepted

AFAIK, out-of-the-box WordPress does not include taxonomies, such as tags and categories, in it's search, only post titles & content.

I'm sure this has always been the case, so I'm a little confused as to why it 'used to work'. Perhaps the pages have been modified, and used to contain the search terms themselves, but no longer do?

UPDATE: Taking a look at your functions.php, I see three possible troublemakers;

  1. Line 572, add_filter('pre_get_posts', 'query_post_type');
  2. Line 597, add_filter('pre_get_posts','SearchFilter');
  3. Line 776, add_filter('posts_groupby', 'group_by_post_type' );

I suggest, one at a time, commenting out the line (prepend the line with //) and then testing a search. If there are no improvements, try all three commented out and work your way backwards. Either way you should be able to isolate the problem.

Also, two minor improvement suggestions (off-topic);

  1. Remove the line add_action('init', 'my_init_method'); (it's worthless)
  2. Remove the two update_option calls at the top (unneccessary database writes on every request).
share|improve this answer
At the very minimum I should be seeing a result simply from the title or the text in the body. I'm not concerned about taxonomies or categories. The pages have not been changed in any drastic fashion. – Zach Shallbetter May 5 '11 at 15:57
Apologies, I'd only glanced at the screenshot. Try searching for "Support" - note the case. I've an inkling to the problem. – TheDeadMedic May 5 '11 at 16:09
"Support" returns the same result, the products page. – Zach Shallbetter May 5 '11 at 16:22
I'm scratching my head here. What happens if you run a search on the front-end, i.e. http://mysite.com/?s=support ? – TheDeadMedic May 5 '11 at 21:28
It returns incorrect result, I updated the post to show that information. – Zach Shallbetter May 6 '11 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.