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

1 Answer 1


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).
  • 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. Commented May 5, 2011 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. Commented May 5, 2011 at 16:09
  • "Support" returns the same result, the products page. Commented May 5, 2011 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 ? Commented May 5, 2011 at 21:28
  • It returns incorrect result, I updated the post to show that information. Commented May 6, 2011 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.