Skip to main content

benecaster_ai_search_before_search

Action Premium ai-search

Fires when a visitor’s search from the benecaster_ai_search box has passed every check (AI Search on for the show, the visitor signed in when the box is for signed-in visitors only, a query of 2 to 200 characters, the visitor within the rate limit), just before the provider is asked. Not fired for a refused request.

Parameters

Name Type Default Description
$query string — The search, trimmed
$show_id int — The show searched

Example

add_action( 'benecaster_ai_search_before_search', function ( string $query, int $show_id ): void {
    do_action( 'my_plugin_timer_start', 'ai_search' );
}, 10, 2 );

Notes

It fires whether or not the search then reaches the provider: a repeated query answered from its saved vector or ranking, or a show that reached its daily limit, still fires it. Walkthrough: Read, change or log AI Search's search results.

Affects

  • GET benecaster-ai-search/v1/search

Need this built rather than just documented? See our services →