action
Register searchable content sources.
Fired once per request, on 'init'. Use $registry->register() to make a domain's content searchable.
Parameters of davo_register_search_sources Parameter Type Description $registry Search_Registry Shared searchable-source registry.
add_action Copyadd_action ( 'davo_register_search_sources' , 'my_action_callback' , 10 , 1 );
/**
* @param Search_Registry $registry
*/
function my_action_callback ( $registry ) {
// Your code here.
}src/domains/search/initializer.php:353
filter
Filters the avatar URL shown for an anonymous author in search results. Defaults to a generic person icon.
Parameters of davo_search_anonymous_avatar_url Parameter Type Description $url string Avatar image URL.
Returns string
add_filter Copyadd_filter ( 'davo_search_anonymous_avatar_url' , 'my_filter_callback' , 10 , 1 );
/**
* @param string $url
*/
function my_filter_callback ( $url ) {
// Change $url as needed, then return it.
return $url ;
}src/domains/search/helpers.php:348
filter
Filters the language a document is written in.
A resolver can set lang_code itself. Otherwise the active multilingual plugin is asked for the language of the post or term behind the document. An empty value marks it as not tied to a language.
Parameters of davo_search_document_language Parameter Type Description $code string Language code, or empty. $object_type string Registered source key. $object_id int Post, term or user ID, matching the source's binding. $source array<string, mixed> The registered source.
add_filter Copyadd_filter ( 'davo_search_document_language' , 'my_filter_callback' , 10 , 4 );
/**
* @param string $code
* @param string $object_type
* @param int $object_id
* @param array<string, mixed> $source
*/
function my_filter_callback ( $code , $object_type , $object_id , $source ) {
// Change $code as needed, then return it.
return $code ;
}src/domains/search/repository.php:152
filter
Filters the language untranslated documents are shown in.
Parameters of davo_search_fallback_language Parameter Type Description $code string Language code. Empty for no fallback.
add_filter Copyadd_filter ( 'davo_search_fallback_language' , 'my_filter_callback' , 10 , 1 );
/**
* @param string $code
*/
function my_filter_callback ( $code ) {
// Change $code as needed, then return it.
return $code ;
}src/domains/search/repository.php:118
filter
Filters the language search results are restricted to.
Documents written in another language are left out; documents with no language (users, questions, anything a multilingual plugin does not translate) are always kept.
Parameters of davo_search_language Parameter Type Description $code string Language code. Empty for no restriction.
add_filter Copyadd_filter ( 'davo_search_language' , 'my_filter_callback' , 10 , 1 );
/**
* @param string $code
*/
function my_filter_callback ( $code ) {
// Change $code as needed, then return it.
return $code ;
}src/domains/search/repository.php:101
action
Fires after a full search ran for its first page.
Not fired for suggestions as the visitor types, for later pages, or for an invalid query.
Parameters of davo_search_performed Parameter Type Description $query string Trimmed search text. $total int Number of results found. $args array<string, mixed> Search arguments as passed in.
add_action Copyadd_action ( 'davo_search_performed' , 'my_action_callback' , 10 , 3 );
/**
* @param string $query
* @param int $total
* @param array<string, mixed> $args
*/
function my_action_callback ( $query , $total , $args ) {
// Your code here.
}src/domains/search/repository.php:716
filter
Allow domain archives to retain their own search and filter context.
Parameters of davo_search_redirect_native Parameter Type Description $redirect bool Whether to redirect to global search.
add_filter Copyadd_filter ( 'davo_search_redirect_native' , 'my_filter_callback' , 10 , 1 );
/**
* @param bool $redirect
*/
function my_filter_callback ( $redirect ) {
// Change $redirect as needed, then return it.
return $redirect ;
}src/domains/search/initializer.php:481
filter
Filters whether a search results view is sent with a noindex directive.
Parameters of davo_search_results_noindex Parameter Type Description $noindex bool Default true. $query string Search query. $page int Results page. $has_filters bool Whether any filter is applied.
add_filter Copyadd_filter ( 'davo_search_results_noindex' , 'my_filter_callback' , 10 , 4 );
/**
* @param bool $noindex
* @param string $query
* @param int $page
* @param bool $has_filters
*/
function my_filter_callback ( $noindex , $query , $page , $has_filters ) {
// Change $noindex as needed, then return it.
return $noindex ;
}src/domains/search/helpers.php:195
filter
Registers the source keys a surface scope searches.
The default comes from each source's registered scopes. Unknown scopes remain empty. The result is intersected with the visible sources, so a scope can narrow a request but never widen it.
Parameters of davo_search_scope_object_types Parameter Type Description $object_types array<int, string> Source keys for the scope. $scope string Surface scope key.
add_filter Copyadd_filter ( 'davo_search_scope_object_types' , 'my_filter_callback' , 10 , 2 );
/**
* @param array<int, string> $object_types
* @param string $scope
*/
function my_filter_callback ( $object_types , $scope ) {
// Change $object_types as needed, then return it.
return $object_types ;
}src/domains/search/repository.php:1456, and 1 more place
filter
Filters one result row for a scoped request (suggest / recent).
Return null to omit the result, e.g. when the viewer may not open it.
Parameters of davo_search_scope_result Parameter Type Description $result array<string, mixed>|null Response row. $scope string Surface scope key. $document array<string, mixed> Source document the row was built from.
add_filter Copyadd_filter ( 'davo_search_scope_result' , 'my_filter_callback' , 10 , 3 );
/**
* @param array<string, mixed>|null $result
* @param string $scope
* @param array<string, mixed> $document
*/
function my_filter_callback ( $result , $scope , $document ) {
// Change $result as needed, then return it.
return $result ;
}src/domains/search/repository.php:1485
action
Fires after a search source is successfully registered.
Parameters of davo_search_source_registered Parameter Type Description $object_type string Normalized object_type key. $source array<string, mixed> Normalized source definition.
add_action Copyadd_action ( 'davo_search_source_registered' , 'my_action_callback' , 10 , 2 );
/**
* @param string $object_type
* @param array<string, mixed> $source
*/
function my_action_callback ( $object_type , $source ) {
// Your code here.
}src/domains/search/search-registry.php:266
filter
Filters how many suggestions each source contributes to the dropdown.
Parameters of davo_search_suggest_per_type Parameter Type Description $per_type int Max results per source. $scope string Surface scope key ('' when unscoped).
add_filter Copyadd_filter ( 'davo_search_suggest_per_type' , 'my_filter_callback' , 10 , 2 );
/**
* @param int $per_type
* @param string $scope
*/
function my_filter_callback ( $per_type , $scope ) {
// Change $per_type as needed, then return it.
return $per_type ;
}src/domains/search/repository.php:1358