I've been trying to get contact form 7 post data to debug the form submission so that I can use it for a plugin I'm trying to work on. However, when I use var_dump or print_r, I can't get the data anywhere.
I've started with this.
add_action( 'wpcf7_before_send_mail', 'my_process_cf7_form_data' );
function my_process_cf7_form_data() {
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
}
var_dump($posted_data);
}
But I'm not getting any output.
See Question&Answers more detail:os