问题
I am working on a WordPress site, where I have created a Contact Form
.
So whenever someone clicks to apply
for a job advert it takes them to a Contact Form
Example site - https://www.inext.se/job/solution-architect/
Application Contact Form - https://www.inext.se/job-apply-form/?id=6770
Now I am trying to get is the previous URL subject/title
or the previous URL
.
In JavaScript, I know it is possible to get it by -
<script type="text/javascript">
document.write(document.referrer);
</script>
But I didn't find anywhere how to get in a form mail
message body
.
I have tried to use -
[_url]
[_post_name]
[_post_title]
But this gives me the form URL which is useless for me.
Do anyone know any solution!
回答1:
I think your best shot is to add a parameter in the URL from the page you are leaving. Doing that will bring the user to the new page with an extra GET parameter that can be your title/url.
With Cf7 you have a very ugly way to do that which is described here: https://contactform7.com/getting-default-values-from-the-context/
As long as your cf7 form item name equals the GET parameter name, you are good to go. The bad thing about this is that you have no pre-processing power and you need to pass values directly in the URL, w/o any encode (that's from what i know at least)
来源:https://stackoverflow.com/questions/64426854/how-to-get-the-previous-url-in-form-message