Tune invalid token alerts per show
The “Unusual failed feed access” alert defaults to 10 unknown-token requests in 60 minutes, per show. A show with a large audience and a lot of mis-copied URLs may need a higher bar before it’s worth an alert; a show you use for testing may not want the alert at all.
benecaster_invalid_token_alert_threshold receives the show ID, so tuning can target specific shows rather than the whole install. Returning false or null switches monitoring off for that show entirely — no counting, no benecaster_invalid_token_recorded, no alert. Any other non-array return falls back to the defaults, so a bug in your callback can’t silently disable the alarm.
Code
<?php
add_filter(
'benecaster_invalid_token_alert_threshold',
function ( array $config, int $show_id ) {
// A staging or test show: no monitoring at all. Returning false
// also stops benecaster_invalid_token_recorded for this show.
if ( 123 === $show_id ) {
return false;
}
// A high-traffic show: only alert on a heavier burst, over a
// shorter window.
if ( 456 === $show_id ) {
return [ 'count' => 50, 'window_minutes' => 30 ];
}
return $config;
},
10,
2
);
Hooks Used
Need this built rather than just documented? See our services →