Skip to content

Instantly share code, notes, and snippets.

@rafaelmaeuer
Created August 30, 2024 10:32
Show Gist options
  • Save rafaelmaeuer/d5244395e1acdf6c1ae7a18a6cb36364 to your computer and use it in GitHub Desktop.
Save rafaelmaeuer/d5244395e1acdf6c1ae7a18a6cb36364 to your computer and use it in GitHub Desktop.
<!-- in functions.php add -->
function debug_cf7_add_error( $items, $result )
{
if ( 'mail_failed' == $result['status'] ) {
// invoke global phpmailer object
global $phpmailer;
// append error info to ajax response.
$items['errorInfo'] = $phpmailer->ErrorInfo;
}
return $items;
}
add_action( 'wpcf7_ajax_json_echo', 'debug_cf7_add_error', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment