I get some dynamic data in the URL that I want to send in my mails.
I use the short code [_url] resulting in this when sending the mails: http://www.example.com/dynamic-content
I want to remove my domain name and only send the dynamic data when using [_url].
Anyone know how to make a function for this?
You can add a custom form tag using the wpcf7_form_tag()
function.
Using that, you can then return whatever data - or make whatever changes to that data - that you like.
In your theme's functions.php :
add_filter("wpcf7_form_tag", "so_37392974_cf7_url");
function so_37392974_cf7_url($form_tag){
if($form_tag["name"] == "_custom_url"){
$form_tag["values"][] = $_SERVER["REQUEST_URI"];
}
return $form_tag;
}
When you then add the [_custom_url]
tag to your form's e-mail template, it will return something similar to /dynamic-content
.
I'm not sure exactly what different forms you are planning on that 'dynamic_content' portion to take, but you can use any PHP function (such as str_replace, substr etc.) to massage the value in the function above before returning it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.