Contact Form 7 Issues Tricks and Solution

Contact Form 7 Hidden Field to get the Page or Post URL where the form is used

Sometimes you may need to use Hidden Field in Contact Form 7 to get the URL of the Post or page where the form is used.

I have used [hidden url] as field field (screenshot below), to get the URL of the page I used the form.

At last, use this JQuery code to get the URL value Automatically

<script>

jQuery(document).ready(function(){
var url      = window.location.href;  
console.log("url"+url);		 
jQuery('input.wpcf7-form-control.wpcf7-hidden').attr("value",url) ; 	
 }); 	
</script>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s