benecaster_ai_search_locked_result
Filters the card a locked search result is shown as, in a benecaster_ai_search box with result_visibility="locked". Called once for each result the visitor cannot open. Return your own markup to replace the card; $cta_html is the default upgrade link, to reuse.
The default card is a padlock (.benecaster-ai-search__lock, labeled Locked), the title linked to the episode’s page (.benecaster-ai-search__link), a tier line (.benecaster-ai-search__tier) and the upgrade link (.benecaster-ai-search__cta), inside .benecaster-ai-search__locked. The tier line reads Available to {tier} subscribers when exactly one paid tier opens the episode, and Available to subscribers otherwise.
Never add the episode’s description, notes or transcript: the visitor cannot open it. The result is passed through wp_kses(), with what a post may contain plus svg and path, before it is sent, because the box inserts it as HTML.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$card |
string |
— | The card's markup |
$episode_id |
int |
— | The locked episode |
$user_id |
int |
— | The visitor; `0` when signed out |
$cta_html |
string |
— | The default upgrade link's markup: `locked_cta_url`, else the show's sign-up page for this visitor, labeled `locked_cta_label`, else *Subscribe to access* |
Returns:
string
Example
// A members-only card that names the price.
add_filter( 'benecaster_ai_search_locked_result', function ( string $card, int $episode_id, int $user_id, string $cta_html ): string {
return '<div class="benecaster-ai-search__locked my-locked">'
. '<strong>' . esc_html( get_the_title( $episode_id ) ) . '</strong> '
. esc_html__( 'is for members, from $5 a month.', 'my-theme' ) . ' ' . $cta_html
. '</div>';
}, 10, 4 );
Notes
Walkthrough: Show locked search results, or replace their card.
Affects
- [benecaster_ai_search] shortcode
Need this built rather than just documented? See our services →