Skip to main content

Contact Form

A contact form with your own fields, validation and email delivery.

The block renders through the contact_form element — the same PHP that runs in the page builder, so the front end is identical either way.

What the sidebar exposes

OptionWhat it does
formThe form's fields
email_toWhere submissions are sent
subject_messageSubject line of that email
submit_button_textButton text
success_messageShown after a successful send
failure_messageShown when it fails
mailerHow mail is delivered (read-only — see below)
form_max_widthMaximum form width
form_alignHorizontal alignment
field_bgField background
field_textField text colour
field_borderField border colour
field_focusFocus colour
label_colorLabel colour
field_radiusField corner rounding
field_border_widthField border width
field_paddingField padding
button_styleButton preset
button_sizeButton size
button_shapeButton shape
button_fullFull-width button
button_alignButton alignment

Anything not listed stays available in the page builder, and round-trips untouched.

Fields are edited here, as a list

form is a form-builder. Add a field from the dropdown, expand it to edit its own settings — a text field offers its constraints, a select its choices — reorder with the arrows, duplicate or remove.

Field widths stay in the page builder, which lays fields out on a grid. Widths already set are preserved untouched.

caution
mailer is shown but not editable

Mail delivery is a site-wide setting stored in a wp_option — SMTP host, credentials, send method. A block's attributes never reach that storage, so an editable field here would write mail settings into one block where nothing reads them: mail would keep using the site configuration, the fields would look saved, and the difference would show up as messages that silently never arrive.

The block tells you whether delivery is configured and where to change it.

The form does not submit in the editor

Live, a stray Enter in the canvas would send a real message to email_to, from the editor, while someone was still building the form.

The security nonce is minted per render, so nothing stale is stored in the block.

note
Set email_to before publishing

It is the one setting a form cannot do without, and its absence is invisible until a submission goes nowhere.