WP Webhooks / Docs / fswa_should_dispatch
Filter since v1.0.0

fswa_should_dispatch

Controls whether a webhook should be dispatched for the current trigger event.

$

/ Signature

apply_filters( 'fswa_should_dispatch', $should, $trigger, $args )

/ When it fires

Fires before any delivery decision is made — before condition evaluation, queue insertion, or HTTP dispatch.

/ Parameters

NameInTypeReqDescription
$shouldparamboolyesWhether dispatch is currently allowed. Return `false` to suppress delivery.
$triggerparamstringyesThe WordPress action/filter name that fired.
$argsparamarrayyesArguments passed to the WordPress hook.

/ Returns

bool Return `false` to cancel delivery. Return the original `$should` value to allow it.

/ Examples

Skip autosave and revision events

add_filter( 'fswa_should_dispatch', function ( $should, $trigger, $args ) {
    if ( $trigger === 'save_post' ) {
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return false;
        $post_id = $args[0] ?? 0;
        if ( wp_is_post_revision( $post_id ) ) return false;
    }
    return $should;
}, 10, 3 );

/ Related

Ready

Stop losing webhooks.
Start logging them.

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