Skip to content

Instantly share code, notes, and snippets.

@DuckDivers
Created September 30, 2020 13:11
Show Gist options
  • Save DuckDivers/cbb7acb489cae29df8c215c9691bb0f6 to your computer and use it in GitHub Desktop.
Save DuckDivers/cbb7acb489cae29df8c215c9691bb0f6 to your computer and use it in GitHub Desktop.
Sends CF7 Output to the error log - wherever that is
<?php
// include in functions.php or in a plugin.
// Use var_export, print_r, var_dump, whatever
add_action( 'wpcf7_before_send_mail', 'he_debug_cf7_output');
function he_debug_cf7_output( $contact_form ) {
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
// Dump output to error log
ob_start();
var_export($posted_data);
error_log(ob_get_clean());
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment