Skip to main content

benecaster_invalid_token_alert_threshold

Filter Free

Per-show threshold and window for the “Unusual failed feed access” security alert. Called by Security\InvalidTokenMonitor once per counted failure — only for requests whose token matched no subscriber row, never for valid, revoked, or anonymous requests, so the filter costs nothing on ordinary feed traffic.

Off means off: returning false or null stops counting for the show entirely — nothing is stored, benecaster_invalid_token_recorded does not fire, and no alert is raised.

Any other non-array return falls back to the defaults, deliberately: a filter that breaks (returns a string, forgets to return) must not silently disable a security alarm. Missing keys fall back individually. count is clamped to at least 1; window_minutes to 1–1440 (one day — the counter keeps per-minute buckets, so this also bounds its storage).

Not governed by this filter: the 24-hour cooldown after an alert and the one-hour quiet period after dismissing one.

Parameters

Name Type Default Description
$config array — `[ 'count' => 10, 'window_minutes' => 60 ]` by default — alert when `count` feed requests using a token that matches no subscriber arrive within `window_minutes`.
$show_id int — ID of the show being evaluated.

Returns: array|false|null

Example

add_filter( 'benecaster_invalid_token_alert_threshold', function ( array $config ): array {
    // Raise the threshold for every show at once.
    $config['count'] = 25;
    return $config;
} );

Notes

A one-argument callback that ignores $show_id works — register with accepted_args 1 to change every show at once. See the recipe above for per-show tuning, including switching a show off entirely.

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