DOCS

v1.3.28
 // Pro v1.2.20

 · Latest

Docs/Build Rules/Export & Import Rules

Export & Import Rules

Pro: Export and import require an active Order Daemon Pro licence.

Overview

The WP-CLI export and import commands let you back up your rule configuration or move rules between sites – for example, from a staging environment to production, or from one client site to another.

Export produces a JSON file containing your rules and, optionally, other plugin settings. Import reads that file and applies it to the target site.

Prerequisites

  • Order Daemon Pro installed and active on both source and target sites
  • WP-CLI access to both sites
  • Administrator access or SSH to the server

Exporting rules

wp odcm config export --output=odcm-config.json

This exports all plugin configuration (rules, settings) to odcm-config.json in the current directory.

Common options:

OptionDescription
--output=<file>Output file path. Default: odcm-config.json
--format=jsonOutput format. Currently only JSON is supported
--components=rulesExport only rules. Use all to include all settings
--exclude-sensitiveOmit API keys and credentials from the export

Example – export rules only:

wp odcm config export --output=rules-backup.json --components=rules

Example – export without credentials (safe to commit to a repo):

wp odcm config export --output=rules-backup.json --exclude-sensitive

Importing rules

wp odcm config import rules-backup.json

Import reads the JSON file and creates or updates rules on the current site.

Warning: Importing will overwrite existing rules with the same slug. Run on a staging environment first to verify the result before applying to production.

Common options:

OptionDescription
<file>Path to the configuration file to import (required)
--dry-runSimulate the import without making changes

Example – preview before applying:

wp odcm config import rules-backup.json --dry-run

Typical workflow: staging to production

# 1. Export from staging
wp odcm config export --output=rules-staging.json --components=rules --exclude-sensitive

# 2. Transfer the file to production (via scp, rsync, or your deployment system)

# 3. Preview the import on production
wp odcm config import rules-staging.json --dry-run

# 4. Apply
wp odcm config import rules-staging.json