30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Update Contact Form Template

This replaces the whole template. It is the right tool for restructuring a layout — wrapping fields in columns, rewriting the HTML around them — and the wrong tool for anything field-shaped.

For adding, changing or removing a field, contact-form-7/add-form-field, update-form-field and remove-form-field each rewrite one tag and leave the rest of the markup byte for byte as it was.

At a glance

Abilitycontact-form-7/update-form-template
ToolsetContact Form 7 — toolset/contact-form-7
GroupContact Form 7 › Fields & Template
RequiresContact Form 7, active on the site
Capabilitymanage_options, plus edit_contact_forms
SafetyWrites data
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI Abilities Manager 0.0.34 and later

What this can break

Any field not carried over into the new template is gone — and any mail template still referencing it keeps sending, with a blank line where the value used to be. Nothing in the admin flags that, and the visitor still sees a success message. Run contact-form-7/validate-mail-tags and contact-form-7/validate-form-config immediately afterwards.

How it works

The response returns the parsed fields of the new template alongside the raw markup, so you can compare what the form collects now against what it collected before without a second call.

It also re-runs Contact Form 7’s validator and returns the errors, which catches structural mistakes — a tag in the wrong place, a malformed option.

What neither of those catches is the mail-tag break. That needs contact-form-7/validate-mail-tags, because the mail template is a separate property that this call does not touch.

Input

NameTypeRequiredWhat it is
form_idintegerYesForm post ID, as returned by contact-form-7/list-forms.
templatestringYesThe complete new template.

What comes back

NameTypeWhat it is
form_idintegerThe form that was written.
templatestringThe template as stored.
fieldsarrayThe parsed fields of the new template.
config_errorsarrayWhat Contact Form 7’s validator says now.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation.

Example

Ask your assistant:

Rewrite form 42’s layout to put name and email side by side, keeping all the existing fields.

It resolves to one call:

{
  "ability": "contact-form-7/update-form-template",
  "parameters": {
    "form_id": 42,
    "template": "<div class=\"row\">\n  <label>Your name [text* your-name]</label>\n  <label>Your email [email* your-email]</label>\n</div>\n<label>Message [textarea your-message]</label>\n[submit \"Send\"]"
  }
}

Worth knowing

  • Idempotent — writing the same template twice leaves the same form.
  • Duplicate the form first. There are no revisions to fall back on.
  • Prefer the field abilities for field changes; they cannot drop a field by omission.
  • Always follow with contact-form-7/validate-mail-tags. It is the only check that catches a notification quietly losing a value.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading