Skip to main content

benecaster_rest_rate_limit_buckets

Filter Free Since v1.0.0

Filters the rate limit bucket definitions used by Benecaster’s REST API. Each bucket maps a named group of endpoints to a request allowance and window. Use to raise or lower a limit, or to register a bucket for an add-on’s own routes.

Lowering a limit is generally safe. Raising one shifts load onto your server and, for endpoints that send email, onto your SMTP provider — so raise deliberately rather than to clear a transient error.

Parameters

Name Type Default Description
$buckets array Bucket definitions keyed by bucket name.

Returns: array

Examples

Register a bucket for an add-on route

add_filter( 'benecaster_rest_rate_limit_buckets', function ( array $buckets ): array {
    $buckets['my_addon_export'] = [
        'limit'  => 5,
        'window' => HOUR_IN_SECONDS,
    ];
    return $buckets;
} );