benecaster_ai_search_before_pin_save
Fires before a pinned result is created or changed on Show Settings → AI Search (or through POST / PUT benecaster-ai-search/v1/shows/{show_id}/pins), once the request has passed every check. A new pin arrives without id or created_at. Not fired for a refused request.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$pin |
array |
— | `{ id, show_id, keyword, post_id, active, priority, created_at }`; a new pin has no `id` or `created_at` |
$show_id |
int |
— | The pin's show |
Example
add_action( 'benecaster_ai_search_before_pin_save', function ( array $pin, int $show_id ): void {
error_log( sprintf( 'Pinning post %d for "%s" on show %d', $pin['post_id'], $pin['keyword'], $show_id ) );
}, 10, 2 );
Notes
If the write then fails, benecaster_ai_search_after_pin_save does not fire. Walkthrough: Manage or change AI Search's pinned results.
Affects
- Show Settings → AI Search
Need this built rather than just documented? See our services →