Skip to content

Actions and filters

Ai assistant: 9 hooks.

Every hook here has a description in the source.

1 action8 filters

action

davo_ai_assistant_answered

Fires after the assistant handled a question.

Parameters of davo_ai_assistant_answered
ParameterTypeDescription
$idintLog row ID, 0 when the row could not be written.
$outcomestringanswered, no_answer or error.
$questionstringThe question with personal data masked.
add_action
add_action( 'davo_ai_assistant_answered', 'my_action_callback', 10, 3 );

/**
 * @param int $id
 * @param string $outcome
 * @param string $question
 */
function my_action_callback( $id, $outcome, $question ) {
	// Your code here.
}

src/domains/ai-assistant/repository.php:688

filter

davo_ai_assistant_client_ip

Filters the IP address used to rate-limit the assistant.

Parameters of davo_ai_assistant_client_ip
ParameterTypeDescription
$ipstringAddress resolved from the connecting address and the site's trusted proxies.
add_filter
add_filter( 'davo_ai_assistant_client_ip', 'my_filter_callback', 10, 1 );

/**
 * @param string $ip
 */
function my_filter_callback( $ip ) {
	// Change $ip as needed, then return it.
	return $ip;
}

src/domains/ai-assistant/helpers.php:494

filter

davo_ai_assistant_handoff_url

Filters the address visitors are sent to when the assistant cannot help, normally the ticket form.

Parameters of davo_ai_assistant_handoff_url
ParameterTypeDescription
$urlstringAddress, empty for none.
add_filter
add_filter( 'davo_ai_assistant_handoff_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/ai-assistant/repository.php:695

filter

davo_ai_assistant_instruction_patterns

Filters the patterns that mark a sentence as an instruction aimed at an AI model.

Parameters of davo_ai_assistant_instruction_patterns
ParameterTypeDescription
$patternsstring[]Regular expressions, each with delimiters and flags, matched against one sentence.
add_filter
add_filter( 'davo_ai_assistant_instruction_patterns', 'my_filter_callback', 10, 1 );

/**
 * @param string[] $patterns
 */
function my_filter_callback( $patterns ) {
	// Change $patterns as needed, then return it.
	return $patterns;
}

src/domains/ai-assistant/helpers.php:110

filter

davo_ai_assistant_source_resolvers

Filters the content readers the assistant can use.

A reader receives the object ID and the viewer's user ID and returns array{title: string, url: string, text: string} with plain text, or null when the viewer must not see it. It may add sections, a list of array{heading: string, anchor: string, text: string}, so passages keep their heading and link to it. It is responsible for every visibility check: status, passwords and any membership rule.

Parameters of davo_ai_assistant_source_resolvers
ParameterTypeDescription
$resolversarray<string, callable>Search object type => reader. A reader may also return updated_at, the GMT date the content last changed, which is shown to the visitor beside the source.
add_filter
add_filter( 'davo_ai_assistant_source_resolvers', 'my_filter_callback', 10, 1 );

/**
 * @param array<string, callable> $resolvers
 */
function my_filter_callback( $resolvers ) {
	// Change $resolvers as needed, then return it.
	return $resolvers;
}

src/domains/ai-assistant/services/retrieval.php:506

filter

davo_ai_assistant_stop_words

Filters the words ignored when matching a question to content.

Parameters of davo_ai_assistant_stop_words
ParameterTypeDescription
$wordsstring[]Lower-case stop words.
add_filter
add_filter( 'davo_ai_assistant_stop_words', 'my_filter_callback', 10, 1 );

/**
 * @param string[] $words
 */
function my_filter_callback( $words ) {
	// Change $words as needed, then return it.
	return $words;
}

src/domains/ai-assistant/services/ranker.php:356

filter

davo_ai_assistant_synonyms

Filters the synonym groups used by the knowledge ranker and retrieval layer.

Parameters of davo_ai_assistant_synonyms
ParameterTypeDescription
$groupsarray<int, string[]>Synonym groups (each 2+ lower-case terms).
add_filter
add_filter( 'davo_ai_assistant_synonyms', 'my_filter_callback', 10, 1 );

/**
 * @param array<int, string[]> $groups
 */
function my_filter_callback( $groups ) {
	// Change $groups as needed, then return it.
	return $groups;
}

src/domains/ai-assistant/helpers.php:313

filter

davo_ai_assistant_verify_request

Filters whether a request to the assistant may proceed.

A challenge such as Cloudflare Turnstile or hCaptcha hooks in here: read its token from the request and return a WP_Error (status 403 is expected) to refuse. Runs before any content is searched and before anything is sent to the AI provider.

Parameters of davo_ai_assistant_verify_request
ParameterTypeDescription
$allowedtrue|WP_Errortrue to proceed.
$requestWP_REST_RequestThe request.
add_filter
add_filter( 'davo_ai_assistant_verify_request', 'my_filter_callback', 10, 2 );

/**
 * @param true|WP_Error $allowed
 * @param WP_REST_Request $request
 */
function my_filter_callback( $allowed, $request ) {
	// Change $allowed as needed, then return it.
	return $allowed;
}

src/domains/ai-assistant/routes.php:313, and 2 more places

filter

davo_cache_language_suffix

Filters the language suffix added to every documentation cache key.

Parameters of davo_cache_language_suffix
ParameterTypeDescription
$suffixstringEmpty when the request has no language.
add_filter
add_filter( 'davo_cache_language_suffix', 'my_filter_callback', 10, 1 );

/**
 * @param string $suffix
 */
function my_filter_callback( $suffix ) {
	// Change $suffix as needed, then return it.
	return $suffix;
}

src/domains/docs/services/cache.php:194, and 1 more place

Note. Generated from the plugin source. Descriptions and parameters are the ones written in the code. The starter code uses the parameter names from those comments, or generic names where there are none, so check them against your use.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first