benecaster_ai_search_rate_limit
Filters how many searches one visitor may make a minute in the benecaster_ai_search box. The default is 10, counted in a fixed window from the visitor’s first search; 0 or less switches the limit off. Read on every search, before the provider is asked. Every search is billed to the podcaster’s provider account, which is why the limit is lower than keyword search’s.
A visitor over the limit gets 429 benecaster_ai_search_rate_limited, with retry_after (seconds until the window resets) in the error data, and the box says Too many searches. Please wait a moment and try again. The visitor is their IP address after benecaster_rate_limit_client_ip, so a site behind a proxy that fixed that filter is fixed here too.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$per_minute |
int |
— | Searches a visitor may make a minute; `10` by default |
Returns:
int
Example
// A members-only site where every visitor is signed in can allow more searches a minute.
add_filter( 'benecaster_ai_search_rate_limit', fn( int $per_minute ): int => is_user_logged_in() ? 30 : $per_minute );
Notes
The production panel's admin search is not limited. For a ceiling on what a show can spend however many addresses the searches come from, see benecaster_ai_search_daily_cap. 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 →