WP-CLI commands
For headless, scripted, or automated migrations, the Migrator provides a wp ve-migrate command-line interface. Useful for:
- Running migrations from a deploy script
- Scheduled imports from a staging to production environment
- Integration with CI / CD pipelines
- Large imports where you want to bypass the browser entirely
Import
Dry run (always do this first)
wp ve-migrate import --source=tec --dry-run
Full import
wp ve-migrate import --source=tec
Import specific entities only
wp ve-migrate import --source=tec --entities=event,occurrence
All common options
wp ve-migrate import \
--source=tec \
--batch-size=200 \
--skip-existing \
--create-default-tickets
| Flag | Description |
|---|---|
--source | Source system (tec for The Events Calendar) |
--dry-run | Validate without writing to the database |
--entities | Comma-separated entity types to import (default: all) |
--batch-size | Records per batch (default: 50) |
--skip-existing | Skip records that already exist (default: on) |
--create-default-tickets | Create “General Admission” tickets for events without ticket types |
Export
Export all data to JSON
wp ve-migrate export
Export to a specific file
wp ve-migrate export --file=/tmp/events.json --pretty
Export specific entities
wp ve-migrate export --entities=event,occurrence
Export files are saved to wp-content/uploads/ve-migrator-exports/ by default.
Status
List recent imports
wp ve-migrate status
Details for a specific import
wp ve-migrate status imp_20260412_abc123
JSON output (for scripts)
wp ve-migrate status --format=json
Rollback
Roll back a specific import
wp ve-migrate rollback imp_20260412_abc123
Skip confirmation prompt
wp ve-migrate rollback imp_20260412_abc123 --yes
Rollback deletes all records created by the named import in reverse dependency order (attendees first, then tickets, then events, then categories/tags). Other data is untouched.
Typical workflow
# 1. Back up
wp db export pre-import-backup.sql
# 2. Dry run
wp ve-migrate import --source=tec --dry-run
# 3. Review output for warnings/errors
# (manual step)
# 4. Real import
wp ve-migrate import --source=tec
# 5. Verify
wp ve-migrate status
# 6. If something's wrong, roll back
wp ve-migrate rollback imp_20260412_abc123
Tips
- Redirect output to a file for large imports:
wp ve-migrate import --source=tec > import.log 2>&1 - Use the JSON status output to integrate with monitoring or dashboards:
wp ve-migrate status --format=json | jq - The ID mapping is stored per-import, so you can run multiple imports and roll back individual ones without affecting others