Adds repeatable groups of fields to Contact Form 7.
Updating from an earlier version? Read the 3.0.0 upgrade notes.
This plugin requires these software with the following versions:
- WordPress 7.1+
- PHP 8.3+
- Contact Form 7 6.2.5+
Wrap the desired fields with [field_group your_group_id_here][/field_group]. The shortcode accepts additional parameters, in WP shortcode format and in CF7 fields parameters format as well.
Example:
[field_group emails id="emails-groups" tabindex:1]
<label>Your Email (required)[email* your-email]</label>
[radio your-radio use_label_element default:1 "radio 1" "radio 2" "radio 3"]
[select* your-menu include_blank "option1" "option 2"]
[checkbox* your-checkbox "check 1" "check 2"]
[/field_group]In the mail settings, wrap the fields with your group id. You can use the [group_index] tag to print the group index and an additional __<NUMBER> to print a field at a specific index.
Example:
The second email entered by the user was: [your-email__2]
These were the groups:
[emails]
GROUP #[group_index]
Checkbox: [your-checkbox]
E-mail: [your-email]
Radio: [your-radio]
Select: [your-menu]
[/emails]Starting with 3.0.0, the default buttons read “Add group” and “Remove group”. Adding a row focuses its first available control; removing a row returns focus to a neighboring row’s add button. The buttons inherit the theme’s appearance, with a minimum 44px target size and spacing between rows. Existing button filters still allow custom text and markup.
IDs inside repeated rows receive a unique --cf7rf-<number> suffix, including IDs in the first row. Labels, ARIA references, datalist references, table headers, and fragment links within that row are updated to match. IDs stay stable when other rows are removed. Use classes or field names for CSS and JavaScript hooks, and keep references to repeated IDs inside the same row. This only updates IDs present in the rendered markup; CF7 may omit a field’s explicit ID when the same form is rendered more than once on a page. Wrapping the field in its label works in that case.
Starting with 3.0.0, group events are bubbling DOM CustomEvents. Listen with addEventListener():
document.addEventListener('wpcf7-field-groups/added', (event) => {
const group = event.detail.group;
// Initialize any custom widgets inside this new row.
});| Event | Target | Timing and payload |
|---|---|---|
wpcf7-field-groups/added |
Add button | After the new row is appended, before renumbering. event.detail.group is the new DOM element. |
wpcf7-field-groups/removed |
Remove button | Before the row leaves the DOM. event.detail.group is the row being removed. |
wpcf7-field-groups/change |
Groups container | Updates field names, IDs and their references, validation wrappers, and row counts. Listen on document to observe the updated state. |
To request renumbering after changing rows yourself:
const groups = document.querySelector('.wpcf7-field-groups');
groups.dispatchEvent(new CustomEvent('wpcf7-field-groups/change', {
bubbles: true,
}));Migrate integrations using jQuery .on() and .trigger() to the native event APIs. The old second $new_group argument on the added event is now event.detail.group, a DOM element rather than a jQuery object. Native cloning does not copy attached event listeners; use event delegation or initialize widgets through the added event.
- Hooks available - How to customize the add and remove buttons
- Frequently Asked Questions
You can contribute with code, issues and ideas at the GitHub repository.
If you like the plugin, a review is appreciated :)
- Requires WordPress 7.1+, PHP 8.3+, and Contact Form 7 6.2.5+.
- Group events now use native DOM
CustomEvents. Update integrations using jQuery event handlers; the plugin no longer loads jQuery. See JavaScript events for the event payloads and migration details. - The default buttons now read “Add group” and “Remove group”, and adding/removing a row moves keyboard focus. Existing button filters still work.
- IDs inside repeated rows, including the first row, receive unique suffixes. Update CSS and JavaScript that target these IDs to use classes or field names, and keep label/ARIA references inside their row.
- Group names accept only letters, numbers, underscores, and hyphens. Rename groups using other characters in both the form and mail templates.
- The server accepts at most 50 rows per submitted group by default. Additional rows are not processed for validation or mail. This does not limit the frontend add button. If your form needs more rows, adjust the
wpcf7_field_group_max_rowsfilter before upgrading.
For example, to accept up to 100 rows for the emails group while keeping the default for other groups:
add_filter( 'wpcf7_field_group_max_rows', function ( $max_rows, $group_id ) {
return 'emails' === $group_id ? 100 : $max_rows;
}, 10, 2 );A complete listing of all notable changes to this plugin are documented in CHANGELOG.md.