WP Webhooks / Docs / fswa_max_attempts
Filter since v1.1.0

fswa_max_attempts

Sets the maximum number of delivery attempts before a webhook is marked permanently failed.

$

/ Signature

apply_filters( 'fswa_max_attempts', $attempts, $webhook_id )

/ When it fires

Fires when a delivery is put on the queue; the result is stored on the queue job, and later retries compare against that stored value rather than re-running the filter. It also runs on each attempt to fill max_attempts in the fswa_delivery_event context.

/ Parameters

NameInTypeReqDescription
$attemptsparamintyesMax attempts, resolved from the webhook's own retry limit, then the site-wide setting, then `5`. Test sends always get 1 and do not run this filter.
$webhook_idparamintyesWebhook configuration ID.

/ Returns

int Maximum number of attempts. Cast to int, not clamped — return at least 1.

/ Examples

Give critical webhooks more attempts

add_filter( 'fswa_max_attempts', function ( $attempts, $webhook_id ) {
    $critical = [ 12, 17 ]; // webhook IDs
    return in_array( $webhook_id, $critical, true ) ? 10 : $attempts;
}, 10, 2 );

/ Related

Ready

Your next automation is
one sentence away.

$ wp plugin install flowsystems-webhook-actions --activate