Forms
The form command group lets you version-control forms as plain JSON files in Git.
Requires WPForms to be installed and active on the WordPress site. Other form plugins aren’t supported yet.
Typical workflow
Section titled “Typical workflow”# 1. Download existing forms from WordPresslps form pull
# 2. Edit locally, commit to Gitgit add forms/ && git commit -m "feat: update contact form"
# 3. Deploy back to WordPresslps form pushCommands
Section titled “Commands”lps form pull
Section titled “lps form pull”Download all forms from WordPress and write them as .json files, one per form.
lps form pull [path]| Argument | Default | Description |
|---|---|---|
path |
./forms (or loopress.json’s formDir) |
Local directory where forms are written |
| Flag | Description |
|---|---|
--dry-run / -d |
Show what would be written without touching the filesystem |
Local files with an id no longer present on WordPress are removed on pull, so the directory always mirrors the site. In a terminal the files are listed and a confirmation is asked first (--yes skips it); in scripts and CI they are removed and reported. Forms with no id are skipped with a warning.
Example:
lps form pull --dry-runlps form push
Section titled “lps form push”Upload .json files from a local directory to WordPress. Each form is matched by its id; if a local id doesn’t exist on the target site (e.g. a fresh install), a new form is created instead and the local file is renamed to match the assigned id.
lps form push [path]| Argument | Default | Description |
|---|---|---|
path |
./forms (or loopress.json’s formDir) |
Local directory to read .json files from |
| Flag | Description |
|---|---|
--dry-run / -d |
Show what would be pushed without making any changes |
Example:
lps form push ./formslps form list
Section titled “lps form list”Print all forms currently on WordPress.
lps form list| Flag | Description |
|---|---|
--json / -j |
Output raw JSON instead of formatted text |
Example output:
Forms (2): 12. Contact Form 17. Newsletter SignupFile format
Section titled “File format”Each form is stored as one file, named {id}-{slug}.json, where {slug} is the form title lowercased and slugified:
forms/ 12-contact-form.json 17-newsletter-signup.jsonFiles round-trip WPForms’ own export format untouched, the CLI only reads id to name the file and settings.form_title to display the form.