Skip to content

Make multiple webhooks optionals

Mário Valney edited this page Feb 18, 2026 · 1 revision

Since 2.4.0 we accept multiple webhooks in every contact form: just add one webhook per line in “Webhook URL” settings.

We will trigger one webhook by time.
If one of them fail, the next WILL NOT be trigged.

To make webhooks optionals (not stop when fails) you should:

1 – Return any error messages:

add_filter( 'ctz_trigger_webhook_error_message', '__return_empty_string' );

2 – Trigger errors at end (optional):

add_action( 'ctz_trigger_webhook_errors', 'example_ctz_trigger_webhook_errors', 10, 2 );

function example_ctz_trigger_webhook_errors( $errors, $contact_form ) {
    // Here you can use $errors to get exception messages
    // $errors is a array of 'webhook' (the URL) and 'exception' (the catched one)
    
    $submission = WPCF7_Submission::get_instance();
    $submission->set_status( 'mail_failed' );
    $submission->set_response( $contact_form->message( 'mail_sent_ng' ) );
}

Clone this wiki locally