Create custom tag and output the value of an acf assigned to that page
-
I am using contact form 7 in the footer, but it will only be displayed in the posts
Each entry has an acf that shows a field (email in this case) when editing the page
In short: on each page you have a different email using an acfWhat I want is that when an email is sent in the form that it collects the email from that acf and that email is sent to the acf email
add_filter("wpcf7_special_mail_tags", function( $output, $name, $html ) { if ( $name === "_current_url_cs" ) { $page_id = get_the_ID(); $extra_email = get_field('email_del_centro', $page_id); if ($extra_email) { return $extra_email; } } return $output; }, 99, 3 );
I have created this code but if $extra_email = “text”
When sending an email it does print the “text”
but if the code is this $extra_email = get_field(’email_del_centro’, $page_id);
what prints the email when it is sent is only the tag [_current_url_cs]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Create custom tag and output the value of an acf assigned to that page’ is closed to new replies.