Created
February 11, 2021 20:39
-
-
Save KustomDeveloper/e5b00573d92f2b91f9b1c8ca6bac37cf to your computer and use it in GitHub Desktop.
Get data from contact form 7 submission for use in another function like for example: mailchimp, constant contact, etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function run_function_with_cf7_data($WPCF7_ContactForm) { | |
$submission = WPCF7_Submission::get_instance(); | |
if ( $submission ) { | |
// $posted_data = $submission->get_posted_data(); | |
$email = $submission->get_posted_data('your-email'); | |
ob_start(); | |
echo '<pre>'; | |
print_r($email); | |
echo '<pre>'; | |
$content = ob_get_clean(); | |
wp_mail('[email protected]', 'Debug', $content); | |
} | |
} | |
add_action( 'wpcf7_mail_sent', 'run_function_with_cf7_data' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment