---
title: "fswa_max_attempts — Filter Hook"
description: "Sets the maximum number of delivery attempts before a webhook is marked permanently failed."
url: "https://wpwebhooks.org/docs/fswa-max-attempts/"
---

[WP Webhooks](https://wpwebhooks.org/) / [Docs](https://wpwebhooks.org/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 new queue job is created and before each retry to determine if more attempts remain.

/ Parameters

| Name | In | Type | Req | Description |
| --- | --- | --- | --- | --- |
| $attempts | param | int | yes | Max attempts. Default: \`5\`. Test webhooks always get 1. |
| $webhook\_id | param | int | yes | Webhook configuration ID. |

/ Returns

`int` Maximum number of attempts. Minimum: 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

[fswa\_backoff\_delay](https://wpwebhooks.org/docs/fswa-backoff-delay/)[Smart Retry with Exponential Backoff](https://wpwebhooks.org/docs/smart-retry/)[Per-Webhook Retry Settings](https://wpwebhooks.org/docs/per-webhook-retry/)

/Ready

## Your next automation is  
one sentence away.

[Install Plugin→](https://wordpress.org/plugins/flowsystems-webhook-actions/) [See the Plugin →](https://wpwebhooks.org/wordpress-webhook-plugin/)

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

## Structured data

```json
{"@context":"https://schema.org","@type":"TechArticle","name":"fswa_max_attempts — Filter Hook — Webhook Actions Docs","description":"Sets the maximum number of delivery attempts before a webhook is marked permanently failed.","url":"https://wpwebhooks.org/docs/fswa-max-attempts/","isPartOf":{"@type":"WebSite","name":"WP Webhooks","url":"https://wpwebhooks.org"},"about":{"@type":"SoftwareApplication","name":"Webhook Actions","applicationCategory":"WordPress Plugin"}}
```
