Codex tools: Log in
The filter eliminates duplicates in your search results.
The following example shows how to use the filter in a plugin:
function search_distinct() {
return "DISTINCT";
}
add_filter('posts_distinct', 'search_distinct');
If you return an empty string from the filter, duplicates will continue to show. For example:
function search_distinct() {
if ( $this->allow_duplicates )
return ""; // filter has no effect
return "DISTINCT";
}
add_filter('posts_distinct', 'search_distinct');
Returning "DISTINCTROW" from the filter has the same effect on the query as "DISTINCT".