WordPress Tricks

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>

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

  1. Hello,

    Kindly provide us with the price quote for the items below at your earliest convienence

    HP 507A Cyan Toner Cartridge (CE401A) —————10 pcs

    HP 507A, Magenta Original Toner Cartridge (CE403A) ———————10pcs

    HP 507A, Yellow Original Toner Cartridge (CE402A) —————————10pcs

    HP 507A, Black Original Toner Cartridge (CE400A) ——————————10pcs

    Payment : Net 30

    Quotation must be submitted on or before 10/30/2020 .Quotes after due date may not be accepted.

    Esther Schneider
    Manager, Strategic Sourcing
    DuPont de Nemours, Inc.

    Like

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 )

Facebook photo

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

Connecting to %s