Skip to content

WP-CLI

OctaForms ships a small set of WP-CLI commands, all under wp octa-forms. They are the right tool for cron jobs, deploy scripts and CI.

Drain the delivery queue now. This is the command to run from a system cron. See Cron and the delivery queue.

Terminal window
wp octa-forms queue drain

Show the queue’s current state (backlog, worker health):

Terminal window
wp octa-forms queue status

These import form definitions that ship as JSON in your theme. The full workflow is covered in Forms in your theme (sync).

Show the sync status of every theme form file:

Terminal window
wp octa-forms theme status

Import forms from the theme into the database:

Terminal window
wp octa-forms theme import --all # import every file; exits non-zero on any failure (good for CI)
wp octa-forms theme import --slug=contact # import one form
wp octa-forms theme import --all --force # also overwrite conflicts

Import never deletes anything. Removing a theme file leaves the form in the database untouched.

These move forms between sites with an export file, the same file the Import & export screen uses. See Export and import forms.

Export every form, or only some, to a file. Without --file the JSON is printed:

Terminal window
wp octa-forms forms export --file=forms.json
wp octa-forms forms export --slug=contact,offer > forms.json

Import a file. New forms are imported. --on-conflict decides what happens to a form whose slug already exists: skip (the default), replace or copy. A callback widget form is never copied.

Terminal window
wp octa-forms forms import forms.json --dry-run # show what would happen
wp octa-forms forms import forms.json # import new forms, skip existing ones
wp octa-forms forms import forms.json --on-conflict=replace # also replace existing forms

Imported forms are published with every email and webhook turned off, exactly as on the screen. The command exits non-zero when any form fails to import.