Get Contact Form 7 Posted Data in PHP - Updated for v3.9

Use this function...added to your Wordpress theme's functions.php file

This PHP function is run before the form sends an email.  You can use this to store the form data in a database or post to another system.

The old $cf7->posted_data['your-email'] doesn't collect the form posted data in the new version of Wordpress Contact Form 7 v3.9+

function something_before_sending_email($cf7) {

$submission = WPCF7_Submission::get_instance();

if ( $submission ) {

$name = $_POST['your-name'];
$email = $_POST['your-email'];

}

}
add_action('wpcf7_before_send_mail',something_before_sending_email');

Comments

Popular posts from this blog

How to Display Custom Wordpress Header with Google Analytics Site Tage and Adwords Site Tag