Plugin API/Filter Reference/posts distinct

来自WordPress中文文档
跳转至: 导航搜索

Description

The filter eliminates duplicates in your search results.

Usage

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');

Notes

Returning "DISTINCTROW" from the filter has the same effect on the query as "DISTINCT".

includeonlydiv style=clear:both; background-color:#FAEBD7; border:1px solid #CCCCCC; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;This page is marked as incomplete. You can help Codex by expanding it./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude