Contact Form 7 is a great plugin to add forms to your site, but these forms contain static inputs and sometimes we require to add inputs with dynamic values like a post ID or PHP variables like GET and POST.

This is very easy to do with the plugin Contact Form 7 Dynamic Text Extension.

This plugin adds two additional tag types to the Contact Form 7 plugin, these two types are Dynamic Text field and Dynamic Hidden field, the dynamic value for a scpecif input is generated throught a shortcode.

The plugin has it’s own shortcodes integrated, but you can create your own.

Let me put a very simple example:

Lets say you want to add a hidden input in your form which value should be the current post ID.
If you create your own shortcode it would look like this:

function cf7_add_post_id(){
    global $post;
    return $post->ID;
add_shortcode('CF7_ADD_POST_ID', 'cf7_add_post_id');

And the dynamic field in your form setup would look like this:

[dynamictext my-filed-name "CF7_ADD_POST_ID"]

The other way would be to use the plugin’s shortcodes.
In this case we want to have the current post ID so you would only have to add your dynamic field in the form setup like this:

[dynamictext my-filed-name "CF7_get_post_var key='ID'"]

The plugin has shortcodes for GET, POST, blog info, post info, current URL, custom fields, current user info, referrer URL.
You have all the details in the plugin’s page on

How to add dynamic values into Contact Form 7 inputs
Tagged on:

12 thoughts on “How to add dynamic values into Contact Form 7 inputs

  • January 7, 2016 at 15:27

    my form is build on 4 tabs with cf7 skin multi and in the last tab I would like to summurize the previous input using the dynamic text extension. Have you any idea about how i can get previous input and insert them on the last tab as dynamic text?

    Really Thank You


  • December 13, 2016 at 07:58


    How to add dynamic input text field after select dropdown value in contact form 7

  • March 2, 2017 at 21:47

    How would I go about adding the following in:

    It’s a cookie, but hidden – to get the URL.

  • May 8, 2017 at 08:09

    goddamn thank you!!!! your simply example has helped me no end – i have been trying to get this to work for a number of days with no help from the community. well done.

  • June 18, 2017 at 05:56

    I’m really enjoying the theme/design of your blog. Do you ever run into any browser compatibility issues? A small number of my blog audience have complained about my website not working correctly in Explorer but looks great in Firefox. Do you have any advice to help fix this problem?

  • November 3, 2017 at 13:58

    how do I get that information into the mail that I receive?

  • November 9, 2017 at 06:29


    Can i using above example in same as contact form 7 hidden field.



Leave a Reply

Your email address will not be published. Required fields are marked *