Skip to main content

benecaster_ai_search_signed_in_only

Filter Premium ai-search

Filters whether a show’s benecaster_ai_search box is for signed-in visitors only. The default is the podcaster’s choice on Settings → AI Search (AI Search is for: Everyone, the default, or Signed-in visitors only). Read when a box renders and on every search.

When it returns true, a visitor who is not signed in (is_user_logged_in()) gets benecaster_search for the same show in the box’s place, and the search route refuses them with 401 benecaster_ai_search_sign_in_required before the rate limit, the daily limit or any provider call. The admin production panel is not affected.

Parameters

Name Type Default Description
$signed_in_only bool — The Settings → AI Search choice
$show_id int — The box's show

Returns: bool

Example

// AI Search for signed-in visitors on show 12 only, whatever Settings → AI Search says.
add_filter( 'benecaster_ai_search_signed_in_only', fn( bool $on, int $show_id ): bool => 12 === $show_id ? true : $on, 10, 2 );

Notes

Decide on the server only: the route answers whoever calls it, so nothing in the page can stop a bot. 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 →