Filter since v1.0.0
fswa_payload
Filters the base webhook payload after it is built from the WordPress hook arguments, before it is queued.
$
/ Signature
apply_filters( 'fswa_payload', $payload, $trigger, $args )
/ When it fires
Fires once per trigger event, before the payload is queued. Applies to ALL webhooks watching this trigger. For per-webhook transformation use `fswa_webhook_payload` instead.
/ Parameters
| Name | In | Type | Req | Description |
|---|---|---|---|---|
| $payload | param | array | yes | The built payload. Contains `event`, `hook`, `args`, `timestamp`, `site` keys by default. |
| $trigger | param | string | yes | The WordPress action name. |
| $args | param | array | yes | Raw WordPress hook arguments. |
/ Returns
array Modified payload array. Must remain an array./ Examples
Enrich every payload with current user data
add_filter( 'fswa_payload', function ( $payload, $trigger, $args ) { $user = wp_get_current_user(); if ( $user->ID ) { $payload['acting_user'] = [ 'id' => $user->ID, 'email' => $user->user_email, 'roles' => $user->roles, ]; } return $payload; }, 10, 3 );
/ Related
Ready Stop losing webhooks.
Stop losing webhooks.
Start logging them.
$ wp plugin install flowsystems-webhook-actions --activate