diff --git a/includes/class-cf7-api-admin.php b/includes/class-cf7-api-admin.php index 8165936..7e0f2b2 100644 --- a/includes/class-cf7-api-admin.php +++ b/includes/class-cf7-api-admin.php @@ -445,6 +445,11 @@ public function qs_cf7_send_data_to_api( $WPCF7_ContactForm ) { } } + // Apply the API response error code to the CF7 submission status + $response_code = wp_remote_retrieve_response_code($response); + $submission->set_status($response_code == 200 ? 'mail_sent' : 'mail_failed'); + + do_action( 'qs_cf7_api_after_sent_to_api' , $record , $response ); } }