I can’t get this to work. And it seems impossible to get any real documentation of the process.
I have a custom shortcode in my functions.php, which gets an email adress from an external API. I would like to use this shortcode in the “TO” (i.e. recipient) field in WPCF7. But it keeps giving me an error warning of “syntax error”.
I need to find a way to make the recipient field accept a custom shortcode from my functions.php file.
I’ve tried the dynamic text plugin but it doesn’t work.
Here is an example of my shortcode
function single_email() {
global $contact;
return $contact->email;
}add_shortcode( 'contact_email', 'single_email' );
Maybe something along the line of using “wpcf7_special_mail_tags” and “do_shortcode()”? Not really sure how that works though.
Using Version 4.4.2 of WPCF7.
Can you please check below code?
You can use like this create new field in
wp_options
table and use like this.On Your Contact page
After that you have to create ajax page like this
contact_ajax.php