Skip to main content

Import & Export Overview

Overview

WP-CLI provides two powerful commands for moving WordPress content between sites: wp export generates a WXR (WordPress eXtended RSS) XML file, and wp import reads it back in. Together they power content migrations, staging syncs, and backup workflows.

When to Use XML Export vs Database Export

ScenarioUse
Move posts/pages/media between siteswp export / wp import
Full site migration (settings + everything)wp db export / wp db import
Scheduled content backupwp export (portable XML)
Environment clone (prod → staging)wp db export

Basic Workflow

# On the source site
wp export --dir=/tmp/exports --post_type=post

# Transfer file
scp /tmp/exports/*.xml user@destination:/tmp/

# On the destination site
wp import /tmp/export.xml --authors=create

Key Concepts

  • WXR format — WordPress XML schema that includes posts, pages, comments, terms, and post meta.
  • Authors mapping — When importing, you choose to create, mapping.csv, or skip author matching.
  • Mediawp export does not export media files, only references. Media must be transferred separately.

Next Steps

  • wp export — detailed export options and filtering.
  • wp import — detailed import with author mapping.