Contact Form 7: Get Parameter from URL into Form Plugin

*Updated 3/10/2014*
-Update shortcode init for Contact Form 7 3.7.2
**

There are times when using the Contact Form 7 WordPress plugin where I need to pass a parameter from the URL and into a hidden field or display it in the form. This is great for passing things such as order numbers, selected packages, or even security information.

Download Contact Form 7 – GetParam (v0.9.6)

Automatic Installation

  • It is listed in the WordPress Plugin directory, so you will be able to find it in your WordPress installation’s plugin browser

Manual Installation

  • Go to the “Plugins” section of your WordPress admin panel
  • Click “Add New” at the top
  • Click “Upload” at the top
  • Upload the downloaded zip file
  • Activate the plugin through the ‘Plugins’ menu in WordPress

Adding a Hidden Field

When editing a form in Contact Form 7, enter the getparam shortcode. There is only one valid parameter which is the name of the $_GET value.

[getparam value]

For example, if the URL is http://mysite.com/contact?ordernum=12345, the shortcode will be:

[getparam ordernum]

Then when building the response email, you can pass the value with [ordernum]

Showing the $_GET Value on the Form

When editing a form in Contact Form 7, enter the showparam shortcode. There is only one valid parameter which is the name of the $_GET value.

[showparam value]

For example, if the URL is http://mysite.com/contact?ordernum=12345, the shortcode will be:

[showparam ordernum]

You cannot pass a value to the response email using this method, to do that, you will also have to add a hidden field.