Fix for Search Everything WordPress Plugin

Finally i can activate the Search Everything plugin once again (i temporarily disabled it after upgrading to WordPress 2.1 because of producing duplicate results. Especially if the results can be found on multiple pages). And fortunately there’s someone already found a solution for this problem (many thanks to Tiago Pocinho by creating a fix for this problem)

To fix this problem, you can simply add below lines to the search everything plugin :

add_filter(‘posts_request’, ‘SE2_distinct’);
function SE2_distinct($query){
  global $wp_query;
 
  if (!empty($wp_query->query_vars[‘s’])) {
    if (strstr($where, ‘DISTINCT’)) {}
    else {
      $query = str_replace(‘SELECT’, ‘SELECT DISTINCT’, $query);
    }
  }
  return $query;
}

Yep .. that’s all .. but just in case you want to see a detailed description of this problem, you can see it at Search Everything page at Google Code

Comment?

5 thoughts on “Fix for Search Everything WordPress Plugin

  1. Actually i should be thanking you Dan because of your wonderful search everything plugin and by visiting this small blog :)