Skip to content

Instantly share code, notes, and snippets.

@EdwardNavarro
Forked from REPTILEHAUS/catch-cf7-values.php
Created February 7, 2019 23:28
Show Gist options
  • Save EdwardNavarro/e014aab963c1a6ae8c53df95a75cb97b to your computer and use it in GitHub Desktop.
Save EdwardNavarro/e014aab963c1a6ae8c53df95a75cb97b to your computer and use it in GitHub Desktop.
<?php
function contactform7_before_send_mail( $form_to_DB ) {
global $wpdb;
$form_to_DB = WPCF7_Submission::get_instance();
if ( $form_to_DB )
$formData = $form_to_DB->get_posted_data();
$name = $formData['name'];
$wpdb->insert( 'wp_cf7_test', array( 'name' =>; $name ), array( '%s' ) );
}
remove_all_filters ('wpcf7_before_send_mail');
add_action( 'wpcf7_before_send_mail', 'contactform7_before_send_mail' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment