How to get the value of contact-form-7 fields and integrate it with PHP code

20/06/2019 | By Dev | Filed in: WordPress.
function CF7_pre_send($phpmailer) {
	$output = "";
	$output .= "Name: " . $_POST['your-name'];
	$output .= "Email: " . $_POST['your-email'];
	$output .= "Message: " . $_POST['your-subject'];

	file_put_contents( ABSPATH."/cf7outputtest.txt", $output);

	return $phpmailer;
}
add_action( 'phpmailer_init', 'CF7_pre_send' );

Comments are closed here.