Skip to main content

benecaster_after_integration_action_run

Action Free

Fires after an integration action’s handler returns, whatever it returned. $result is the handler’s array on success — after the benecaster_integration_action_result filter — or a WP_Error when it refused. A handler that throws, returns something that is neither an array nor a WP_Error, or returns a result that cannot be encoded as JSON passes a WP_Error with the code benecaster_action_failed.

Not fired for a replay of an earlier request with the same idempotency key.

Parameters

Name Type Default Description
$action string — The action name, `{addon-slug}.{noun}.{verb}`
$show_id int — The show the caller named
$data array — The validated data the handler received
$user_id int — The calling user
$result array|WP_Error — The handler's result, or the error it refused or failed with

Examples

Alert on a failed integration action

add_action( 'benecaster_after_integration_action_run', function ( string $action, int $show_id, array $data, int $user_id, $result ): void {
    if ( is_wp_error( $result ) && 'benecaster_action_failed' === $result->get_error_code() ) {
        my_alert( sprintf( 'Integration action %s failed on show %d', $action, $show_id ) );
    }
}, 10, 5 );

Notes

A thrown exception's message is never passed here or sent to the caller; the call log records its class.

Need this built rather than just documented? See our services →