Created
January 5, 2022 10:43
-
-
Save aslamdoctor/a5b15207e9976ed378cebbf9bcdb69dc to your computer and use it in GitHub Desktop.
Snippet : Add dynamic data to Contact form 7 email
This file contains 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
<?php | |
add_filter('wpcf7_special_mail_tags', 'add_prospectus_link_to_email', 10, 3); | |
function add_prospectus_link_to_email($output, $name, $html) | |
{ | |
$name = preg_replace('/^wpcf7\./', '_', $name); // for back-compat | |
if ('prospectus' == $name) { | |
$prospectus = get_field('prospectus', 'options'); | |
return $prospectus['url']; | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment