Contact Form 7 Modules – A Plugin

Check out our Contact Form 7 Newsletter Plugin

Easily add Contact Form 7 form submissions to a newsletter list!  Check it out today.

Download the Contact Form 7 Modules plugin from WordPress.org

Add hidden fields to Contact Form 7

I love the Contact Form 7 plugin, and use it for many of my projects…but one thing it misses is the ability to add hidden fields. The Contact Form 7 Modules plugin adds hidden fields to Contact Form 7 in a way that will not break in future upgrades. It’s simple: install the plugin, then edit your form!

Add Every Form Field to Emails At Once

Contact Form 7 makes you copy and paste each of your form’s fields into the email message. This can take a while, and means that if you add a field in the future but forget to put it in your email, you won’t get sent that piece of information.

Now, with the All Fields Module (included in Contact Form 7 Modules plugin), you only need to add one tag to receive every submitted field: `[all-fields]`

Did this make your life easier? Was this information worth a buck?
Donate with PayPal (Much appreciated!)

Author: Zack Katz

Zack Katz is the President of Katz Web Services and the developer of WordPress plugins with over 700,000 downloads. He lives in Southwest Colorado with his wife and two cats.

84 thoughts on “Contact Form 7 Modules – A Plugin”

  1. I posted this question on the WP support forum as well, but thought I might get a faster answer here, so here it is again:

    I need to send an email to a sendmail bot with the following PHP mail function:
    mail(to,subject,message,headers,parameters)
    I can get it to do everything except add the last parameter (it needs to be -f –using the Contact Form 7 code to extract the email address).

    Will this plug in do this for me?

    Thanks.

  2. Hi Zack,
    How can we include the %post_title% from which the contact form was embedded ? Possibly the post title could be the default value of a text field which is then sent in the “additional headers” section…
    Regards,
    Len

  3. Great work. Seems like it will work with only 2.0 (and not 2.0.1, which is the current version). Let me try to get my hands dirty and see if I can help.

  4. When I move over the files, I get this error:

    Fatal error: Call to undefined function wpcf7_admin_url() in /home/content/i/n/t/intweb/html/getintouch/wp-content/plugins/contact-form-7/admin/admin-panel.php on line 40

  5. So, I looked at the original admin.php file and it has a function called “wpcf7_admin_url” which is missing from your new one, which overwrote it. When I added function into your admin.php, the error went away.

  6. Thanks a ton! I was trying to reverse engineer the “text” handler, but somehow that didn’t seem to work. I’ve installed the updated version, but the admin panel for CF 7 doesn’t load and the module doesn’t seem to work. I guess my PHP error messages are disabled, as I don’t get to see any error messages.

  7. Update: Deleted the admin files, left the module file in place. Hidden fields are now parsed in generated forms. But when the forms are submitted, the placeholders [place-holder] are not replaced.

  8. Thanks Courtney, I had the same error.

    The function was left out of the Misc. section of the 2.0.1 update file.

    Seems to be fine now.

    Thanks for a great plugin

  9. Update 2: I uploaded the file “hidden.php” to the modules directory, and manually copied the changes to “admin.php” and “wpcf7-admin.js” in the admin folder. All works well now.

  10. I need the value of the hidden field to be set from the query string.
    Any ideas how to do this?

    Thanks a lot!
    By the way it’s an update, to this great plugin, very helpful for many.
    Tahnks again.

  11. This doesn’t work with WP 2.8.5 and CF7 2.0.6 . Error I get in Admin is:

    Fatal error: Cannot redeclare wpcf7_admin_url() in /home/xxx/public_html/wp-content/plugins/contact-form-7/admin/admin.php on line 324

    I really need hidden fields to work with this plugin 🙁

    Thanks for all your help!

    1. Hi Craig,
      I didn’t know the downloads had disappeared. They’re back up now.

      I am no longer going to support this modification, because the plugin author continues to not add this simple functionality, and the modules functionality requires modifying the plugin core files.

  12. Hi Zack,

    I was really looking fur such a functionality on CF7.
    Unfortunatly the file download is not working (anymore).
    Is there any chance you can fix this?

    Alain

  13. I never used in WORDPRESS because their software is really heavy and full code.
    What I do is use it very effectively YOLA From this perspective.
    Less code, less mess, less headache.

  14. I didn’t have time to go in and make it all pretty but I was able to get the value of the hidden field to be equal to the current post name (which is actually a custom post type in this case).

    I just added this at line 117 of hidden.php:
    if ($value == 'wp-title') { global $wp_query; $value = $wp_query->post->post_name; }

    Now when formatting the hidden field in Contact-7 it should look like this:
    [hidden hidden-849 "wp-title"]

    Thought this may be helpful to those looking to add dynamic values to their hidden fields. Please let me know if this is a poor practice for some reason, I don’t have time to check it extensively at this time.

  15. Hello and thanks for this great plugin…. just a question: when i put [hidden hidden-cat “post_category”]
    it is possible to get all the categories separately, not all ‘in a block’?
    I mean, if the post has two categories (cat1, cat2) i need to get in my email: [cat1] [cat2] and NOT [cat1, cat2].
    many thanks for the help..
    Churro

  16. I’m new to wordpress and plugins and need some help.
    I’m using contact form 7 as a booking form and have also activated the Contact Form 7 Calendar plugin to add date pickers (arrival and departure dates e.g. Thursday, December 9, 2010). I’ve just added the modules plugin (brilliant add on) and was wondering how I would go about adding a hidden field that adds the arrival and departure dates to give me the total number of nights .

    Any ideas would be much appreciated as I’ve exhausted my very limited knowledge and can’t seem to find an answer that works on google.

    THANK YOU!

      1. Hey Zack, where do I grab the latest version of your plugin? When I click on the main link at the top of your page it defaults to another page, not ‘contact form 7 modules’ ??

        1. I also want to download this “Contact Form 7 Modules” plugin but it seems the link to the WP plugin repository is broken. Can you please provide a link to download the plugin? Thanks!

  17. Hello! I have the Contact Form in a template and am trying to get the post_url from this. Post_title could also work, basically anything that would identify which dynamically generated post it came from. I tried this plugin (thank you) but am not sure if it is intended to be used in this way. In any case, it didn’t work.

    1. It’s been a month since you asked about this, but the way I usually work around this kind of things is with jquery, filling the field as soon as the pages loads. Something like

      $(document).ready(function(){ $(“input[name=field-currentpost]”).val(”); });

  18. I scanned the comments, and I’m surprised that this has not been reported, yet. There is a bug in send-all-fields.php that registers the tag menu item with the name “hidden”, which clobbers the hidden menu. This is the original code.

    function wpcf7_add_tag_generator_all_fields() {
        if(function_exists(‘wpcf7_add_tag_generator’)) {
            wpcf7_add_tag_generator( ‘hidden’, __( ‘All Fields’, ‘wpcf7’ ),

    The solution is to change ‘hidden’ to something like ‘allfields’ or ‘all_fields’ (but not ‘all-fields’).

  19. Hi,

    I’m trying to use php to echo the Post ‘name’ fields of Contact Form 7. For example to capture the ‘your-email’ input text field value I’m using a php if(isset($_POST[‘your-email’])) statement. But it’s not working. I need to capture these input fields to send out custom email messages when the form is submitted. Any suggestions? Thanks

    1. I’m having the same problem. Are there plans to update this extremely useful plugin? Hidden fields has been extremely useful to us.

    2. A quick fix is to replace in hidden.php on line 28
      add_action(‘plugins_loaded’, ‘contact_form_7_hidden_fields’, 10);
      with
      add_action( ‘wpcf7_init’, ‘contact_form_7_hidden_fields’, 10 );
      This adds the function to contact form 7 initialization instead of the other hook

  20. The best wordpress forms plugin. One issue that I have with Version 3.7.2 is that the [all-fields] is sent as a string by email “[all-fields]” instead of sending the data the user added in the fields. Is this feature working? Do I have a problem or the plugin does not support this anymore? Thanks!

  21. Hi, Zack! I have a great hope you’ll answer my request.

    Link with “css=1” (show content only+css-styles) doen’t work correctly. It shows only content.

    I’m trying to load by this link ContactForm7. Form appears but doesn’t have it’s styles

  22. Would love to see an option for Parent Title as one of the hidden fields:

    case ‘parent_title’:
    case ‘parent-title’:
    if($post->post_parent>0) {
    $parent = get_post($post->post_parent);
    $value = $parent->post_title;
    }
    break;

  23. hello, since the today update the plugin to send email that we use (Postie) send wrongs all the field, just empty all of them, please help.
    asis

  24. and when back to the previosu version…. everything goes right. please, any ideas to help?
    thanks in advanced.

Leave a Reply

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