Troubleshooting: Search results are missing or the same

Last updated May 2, 2016 « Knowledge Base

SearchWP does it’s best to natively tie into WordPress. It does that by implementing a series of core WordPress hooks that swap out $wp_query->posts at runtime when searches take place. In essence, that’s how SearchWP does it’s job. Unfortunately that doesn’t mean the implementation works with every theme and plugin out there. While it’s a solid approach with many themes and plugins, there are still some times where theme or plugin code prevents SearchWP from outputting it’s relevant search results.

If after activating SearchWP and allowing it to build the initial index you are not seeing improved results (or no results are showing) please check the following:

Case 1: Missing search.php in the theme folder

Many themes utilize what’s called a theme framework to handle a lot of their code. In many cases a part of the theme framework means relying less on WordPress’ Template Hierarchy and more on conditionals (e.g. is_search()) inside the theme code and handling searches internally. In this process the theme framework sometimes performs it’s own search instead, omitting SearchWP’s results.

In this case it’s usually best to create a child theme (see link for a description of what a child theme is) that does have it’s own search.php. You will need to write the search results template from the ground up, but you can utilize the template files in the parent theme to build your search results template so it looks consistent. The theme author should be able to help you find which file(s) to work from.

Case 2: Redundant search in search.php

If your theme does in fact have a search.php it may be performing it’s own redundant search. If you open search.php and see any of the following, your theme is performing it’s own search instead of using the WordPress-provided results:

  • query_posts
  • new WP_Query
  • get_posts

If you search for and find any of the above in search.php or any of the functions called in search.php, it’s likely that your search template is re-running the search and using those results (omitting the results returned by SearchWP).

To resolve this issue you will need to remove the call, instead using a native implementation of The Loop in your search.php.

Case 3: Plugin interference

SearchWP uses hooks to do it’s job, but so do many other plugins. Sometimes plugins (even though they have completely separate purposes) can step on each other’s toes and prevent some functionality. This is sometimes the case with certain types of plugins. The most common to date are plugins that allow you to add custom sorting to your posts. Please see the list of known plugin conflicts for a potential fix if you are not seeing accurate search results after activating SearchWP.

Fix Search on Your Site. No Coding Required!

Now you can utilize all of the content that's gone unrecognized by native WordPress search instantly with SearchWP

Get SearchWP