Contact Form 7 – Conditional Fields


This plugin adds conditional logic to Contact Form 7.

If you edit your CF7 form, you will see an additional tag called “Conditional fields Group”. Everything you put between the start and end tag will be hidden by default.
After you have added the field group(s), click Save and go to the “Conditional fields” tab to create one or more conditions that will make the group(s) appear.

How to use it

Follow this tutorial

Main/ New features

Support for required fields

Required fields can be used inside hidden groups without causing validation problems.

Hide/show info in emails based on what groups are visible

Conditional groups can now be added to the emails as well.
Just wrap the content with [group-name] ... [/group-name] tags.

Groups can be nested

Groups can be nested, both in the form and in the email

Example form:

[group group-1]
  [group group-inside-1]

Example email:



Advanced users can code up the conditions as plain text instead of using the select boxes, using the import/export feature.


  • Conditional fields in action
  • Defining rules to show/hide groups of input elements in the backend interface


Please follow the standard installation procedure for WordPress plugins.

Follow this tutorial if you are not sure how to use the plugin.


Email message is not showing the correct values / Wrong values are submitted

All field names should be unique

Even though your fields might never show up at the same time, it is still important to realize that WPCF7CF will not remove the fields, it merely hides them. So all fields will be submitted when the form is sent. Because of this no two fields can have the same name.

Incorrect form (2 input elements having the same name “a”):

[group group-1][select a "1" "2" "3"][/group]
[group group-2][select a "1" "2" "3"][/group]

Correct form (all groups and fields have unique names):

[group group-1][select a "1" "2" "3"][/group]
[group group-2][select b "1" "2" "3"][/group]
All my groups show up all the time and never get hidden.

Reason #1: Javascript error
Check your browser console (F12) for any javascript errors. WPCF7CF loads it’s scripts at the bottom of the HTML page, so if some javascript error gets triggered before that, the code will not be executed in most browsers.
Before reaching out to the support forum try to determine which plugin or theme is causing the problem, by gradually disabling plugins and changing theme.

Reason #2: wp_footer() isn’t loaded
Check if your theme is calling the wp_footer() function. Typically this function will be called in your theme’s footer.php file.
The conditional fields javascript code is loaded during wp_footer, so a call to this function is crucial. If there is no such call in your theme, go to your theme’s footer.php file and add this code right before the closing </body> tag:
<?php wp_footer(); ?>


19 september 2019
very nice plugin, it does what it needs to do ๐Ÿ™‚
30 juli 2019
Hi, I have a problem using your plugin with the โ€œDrag and Drop Multiple File Uploadโ€ plugin ( Required fields not visible are required anyway and does not allow the form to be submitted. Please add support for this plugin. Thank you!
Lees alle 108 beoordelingen

Bijdragers & ontwikkelaars

“Contact Form 7 – Conditional Fields” is open source software. De volgende personen hebben bijgedragen aan deze plugin.



1.6.4 (07-04-19)

  • PRO: Repeater: Fixed invalid HTML for the remove button
  • Free: Initialize form.$groups as a new jQuery object instead of an empty array, in order to prevent exotic bugs in case $groups aren’t loaded by the time form.displayFields() is called. (

1.6.3 (07-04-19)

  • Removed the word “Pro” from the title in the free plugin

1.6.2 (06-25-19)

  • Small changes to tag generator buttons
  • Multistep bug fix. All group conditions are evaluated a second time after the page has fully loaded.
  • PRO: added new operator ‘function’, allowing you to write custom javascript functions to determine whether or not a group should be shown
  • PRO: fix bug with < (less than) operator

1.6.1 (06-03-19)

  • JS refactoring and small compatibility fix after code rewrite.
  • FREE: Added “Get PRO” button under Contact > Conditional Fields

1.6 (06-01-19)

  • JS code rewrite
  • PRO: allow groups inside repeater
  • PRO: make plugin ready for PRO release.

1.5.5 (05-20-19)

  • Fixed and explained how to disable loading of the styles and scripts and only enable it on certain pages. More info:
  • Made sure default settings get set after activating plugin, without the need to visit the Contact > Conditional Fields page first.
  • PRO: extended the repeater with min and max paramaters and the possibility to change the add and remove buttons texts
  • PRO: enabling the pro plugin will show a notification to disable the free plugin, instead of throwing a PHP error.

1.5.4 (05-06-19)

  • Make sure scripts get loaded late enough (wp_enqueue_scripts priority set to 20), because there was a problem with multistep where the multistep script was changing a value after the cf script ran.

1.5.3 (05-03-19)

  • Refix the fix from version 1.4.3 that got unfixed in version 1.5 somehow ๐Ÿ™„

1.5.2 (05-03-19)

  • by reverting changes in 1.5.1, the possibility to load forms via AJAX was destroyed. So, from now on the wpcf7cf scripts will be loaded in the ‘wp_enqueue_scripts’ hook. Analogous with the WPCF7_LOAD_JS constant, a new constant is defined called WPCF7CF_LOAD_JS wich is set to true by default.

1.5.1 (05-02-19)

  • revert changes: enqueue scripts in ‘wpcf7_contact_form’ hook instead of ‘wpcf7_enqueue_scripts’, because loading it in the latter would cause problems with plugins that disable WPCF7_LOAD_JS (like for example contact-form-7-paypal-add-on).

1.5 (04-21-19)

  • Make it possible to load forms with AJAX and
  • Massive code reorganization in scripts.js
  • Fixed bug that could appear after removing an AND condition.
  • disable part of the faulty remove_hidden_post_data function. –
  • Fix “Dismiss notice” on Conditional Fields Settings page
  • use the “wpcf7_before_send_mail” hook instead of “wpcf7_mail_components” to hide mail groups. The wpcf7_before_send_mail hook is called earlier, so it allows to also hide groups in the attachment field and in messages.
  • Allow conditional group tags in success and error messages.
  • duplicating a form will also duplicate conditions

1.4.3 (04-12-19)

  • Really fix clear_on_hide problem (

1.4.2 (04-10-19)

  • Disabled mailbox syntax errors if there are group tags present. (this is overkill, and should be changed if the necassary hooks become available)
  • Checked issue: (nothing changed, but turns out to be working fine)
  • Fixed issue where mail_2 added extra lines in the email message.
  • Made the clear_on_hide property a bit more useful (
  • Got rid of warning in PHP 7 (
  • Fixed some javascript errors that appeared on non-CF7CF subpages of CF7
  • Tested WP version 5.1.1

1.4.1 (08-21-18)

  • Fixed some CSS issues (
  • Dropped support for PHP version 5.2, now PHP 5.3+ is required to run the plugin. Let’s push things forward!
  • Added conditional group support to mail attachments field (
  • Added repeater field to PRO version.

1.4 (08-15-18)

  • Added basic drag and drop functionality to the back-end so conditional rules can be rearranged.
  • Added possibility to create inline groups by adding the option inline. Example: [group my-group inline] ... [/group]
  • Added property clear_on_hide to clear all fields within a group the moment the group gets hidden. Example: [group my-group clear_on_hide] ... [/group]
  • Added AND conditions and added a bunch of other options in the PRO version (should be released very soon now)
  • Bug fix thanks to Aurovrata Venet (@aurovrata)
  • Bug fix thanks to 972 creative (@toddedelman)


  • small fix (


  • Changes tested with WP 4.7.5 and CF7 4.8
  • Changed the inner mechanics a bit to make the plugin more edge-case proof and prepare for future ajax support
  • Fix problems introduced by CF7 4.8 update
  • Because the CF7 author, Takayuki Miyoshi, decided to get rid of the ‘form-pre-serialize’ javascript event, the hidden fields containing data about which groups are shown/hidden will now be updated when the form is loaded and each time a form value changes. This might make the plugin slightly slower, but it is the only solution I found so far.
  • Small bug fix (


  • Removed a piece of code that was trying to load a non existing stylesheet
  • Updated FAQ
  • Code rearangement and additions for the upcomming Conditional Fields Pro plugin


  • Fixed bug in 1.3 that broke everything


  • Fixed small bug with integration with Contact Form 7 Multi-Step Forms
  • Also trigger hiding/showing of groups while typing or pasting text in input fields
  • Added support for input type=”reset”
  • Added animations
  • Added settings page to wp-admin: Contact > Conditional Fields


  • Make plugin compatible with CF7 Multi Step by NinjaTeam
  • Improve compatibility with Signature Addon some more.


  • Fix critical bug that was present in version 1.2 and 1.2.1



  • Made compatible with Contact Form 7 Multi-Step Forms
  • Small bug fix by Manual from now only considering fields which are strictly inside hidden group tags with form submit. Important in some edge cases where form elements get hidden by other mechanisms, i.e. tabbed forms.
  • Started work on WPCF7CF Pro, made some structural code modifications so the free plugin can function as the base for both plugins.
  • Removed some debug code
  • Updated readme file


  • Added import feature
  • Added support for nested groups in email
  • Tested on WP version 4.7.2 with Contact Form 7 version 4.6.1


  • I feel that at this point the plugin is stable enough in most cases, so it’s about time to take it out of beta ๐Ÿ™‚
  • Update JS en CSS version numbers
  • Fix PHP warning with forms that are not using conditional fields (
  • Tested on WP 4.7.1


  • Re-added wpcf7_add_shortcode() function if wpcf7_add_form_tag() is not found, because some people claimed to get a “function not found” error for the wpcf7_add_form_tag function with the latest version of CF7 installed. ( and
  • Fixed some PHP notices (
  • Attempted to fix error with the CF7 success page redirects plugin (


  • forgot to update version number in 0.2.7, so changing version to 0.2.8 now.


  • Added support for conditional fields in the email (2) field
  • Got rid of some PHP warnings
  • Saving a form only once, directly after adding or removing conditions, caused conditional logic not to work. This is fixed now. Thanks to @cpaprotna for pointing me in the right direction. (
  • Fix validation error with hidden checkbox groups (


  • Fixed problems with exclusive checkboxes in IE (


  • Changed deprecated function wpcf7_add_shortcode to wpcf7_add_form_tag as it was causing errors in debug mode. (
  • Removed the hide option and fixed the not-equals option for single checkboxes


  • Fixed bug that destroyed the conditional fields in email functionality


  • Added support for conditional fields in the other email fields (subject, sender, recipient, additional_headers). Thanks @stevish!
  • WP 4.7 broke the required conditional fields inside hidden groups, implemented in version 0.2. Thanks again to @stevish for pointing this out.
  • Got rid of checking which groups are hidden both on the front-end (JS) and in the back-end (PHP). Now this is only done in the front-end.
  • Tested the plugin with WP 4.7


  • Prevent strict standards notice to appear while adding new group via the “Conditional Fields Group” popup.
  • Only load cf7cf admin styles and scripts on cf7 pages.
  • groups are now reset to their initial states after the form is successfully submitted.


  • Bug fix: arrow kept spinning after submitting a form without conditional fields. (
  • Removed anonymous functions from code, so the plugin also works for PHP versions older than 5.3.
  • Suppress errors generated if user uses invalid HTML markup in their form code. These errors could prevent form success message from appearing.


  • Added support for required conditional fields inside hidden groups. A big thank you to @stevish for implementing this.
  • Added support for conditional fields in the email messages. This one also goes entirely to @stevish. Thanks man!
  • Added @stevish as a contributer to the project ๐Ÿ™‚
  • Fix form not working in widgets or other places outside of the loop. Thanks to @ciprianolaru for the solution (


  • Fix popup warning to leave page even tough no changes have been made. Thanks to @hhmaster2045 for reporting the bug.
  • Added export option for easier troubleshooting.
  • Don’t include front end javascript in backend.


  • made compatible with wpcf7-form-control-signature-wrap plugin


  • fixed PHP notice thanks to @natalia_c
  • tested with WP 4.5.3


  • Prevent conflicts between different forms on one page.
  • Prevent conflicts between multiple instances of the same form on one page. (
  • Changed regex to convert [group] tags to <div> tags, as it was posing some conflicts with other plugins (


  • Removed fielset, id and class attributes for group tags, because they weren’t used anyway and broke the shortcode
  • If extra attributes are added to the group shortcode, this will no longer break functionality (even though no attributes are supported)


  • Make code work with select element that allows multiple options.
  • Only load javascript on pages that contain a CF7 form


Fixed bug with exclusive checkboxes (


First release