Skip to content

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.

Terminal window
# 1. Download existing forms from WordPress
lps form pull
# 2. Edit locally, commit to Git
git add forms/ && git commit -m "feat: update contact form"
# 3. Deploy back to WordPress
lps form push

Download all forms from WordPress and write them as .json files, one per form.

Terminal window
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:

Terminal window
lps form pull --dry-run

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.

Terminal window
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:

Terminal window
lps form push ./forms

Print all forms currently on WordPress.

Terminal window
lps form list
Flag Description
--json / -j Output raw JSON instead of formatted text

Example output:

Forms (2):
12. Contact Form
17. Newsletter Signup

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.json

Files round-trip WPForms’ own export format untouched, the CLI only reads id to name the file and settings.form_title to display the form.