PHPackages                             achttienvijftien/wp-data-migration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. achttienvijftien/wp-data-migration

ActiveLibrary[CLI &amp; Console](/categories/cli)

achttienvijftien/wp-data-migration
==================================

WP-CLI commands for exporting and importing WordPress Custom Post Types with metadata

00PHP

Since Feb 1Pushed 3mo agoCompare

[ Source](https://github.com/achttienvijftien/wp-data-migration)[ Packagist](https://packagist.org/packages/achttienvijftien/wp-data-migration)[ RSS](/packages/achttienvijftien-wp-data-migration/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Data Migration
========================

[](#wordpress-data-migration)

WP-CLI command that generates WXR files for WordPress Custom Post Types with meta filtering. Outputs WXR format compatible with WordPress import.

Installation
------------

[](#installation)

```
composer require achttienvijftien/wp-data-migration
```

Usage
-----

[](#usage)

### Export

[](#export)

Export posts with optional meta filtering:

```
wp data-migration export --post_type= [options]
```

**Required argument:**

- `--post_type=` - Post type to export (required)

**Supported WordPress query arguments:**

- `--post_status=` - Filter by post status (publish, draft, etc.)
- `--author=` - Filter by author ID
- `--post__in=` - Comma-separated post IDs to include
- `--posts_per_page=` - Number of posts to export (-1 for all)
- `--orderby=` - Order posts by field (date, title, etc.)
- `--order=` - Sort order (ASC or DESC)

**Custom meta filtering:**

- `--include-meta=` - Comma-separated meta keys to include
- `--exclude-meta=` - Comma-separated meta keys to exclude

**File splitting:**

- `--max_file_size=` - Maximum file size in MB before splitting (default: 15)
- `--output=` - Custom output filename or base name for split files

**Examples:**

```
# Export all products
wp data-migration export --post_type=product

# Export products with only specific meta
wp data-migration export --post_type=product --include-meta=price,sku,stock

# Export products excluding specific meta
wp data-migration export --post_type=product --exclude-meta=internal_id,temp_data

# Combine with query arguments
wp data-migration export --post_type=product --post_status=publish --include-meta=price,sku

# Export with automatic file splitting (15 MB files)
wp data-migration export --post_type=product --max_file_size=15

# Export with custom max file size (10 MB files)
wp data-migration export --post_type=product --max_file_size=10

# Export with custom base name and file splitting
wp data-migration export --post_type=product --output=products --max_file_size=20
# Creates: products-001.xml, products-002.xml, products-003.xml, etc.
```

**Default Meta Exclusions:**

The following WordPress internal meta keys are excluded by default:

- `_edit_lock`, `_edit_last` (editing locks)
- `_wp_old_slug`, `_wp_old_date` (revision data)
- Keys starting with `_oembed_` (cached embeds)

### Import

[](#import)

Use WordPress core import command:

```
# Install WordPress importer if needed
wp plugin install wordpress-importer --activate

# Import the WXR file
wp import  --authors=create
```

Export Format
-------------

[](#export-format)

Generates WXR (WordPress eXtended RSS) format containing:

- Post data (title, content, excerpt, etc.)
- Post meta (with filtering applied)
- No authors or terms (posts only)

Compatible with:

- WordPress built-in importer
- `wp import` command
- Third-party WordPress import tools

### File Splitting

[](#file-splitting)

For large exports, the plugin automatically splits the export into multiple WXR files when using the `--max_file_size`option:

- Each file is a valid, standalone WXR document with proper headers and footers
- Files are named sequentially: `export-001.xml`, `export-002.xml`, `export-003.xml`, etc.
- Custom base names are supported: `products-001.xml`, `products-002.xml`, etc.
- Splitting occurs when the file approaches the specified size limit
- Each split file can be imported independently or in sequence
- Memory-efficient streaming ensures large datasets (600k+ posts) don't cause memory issues

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
composer test
```

### Code Quality

[](#code-quality)

```
# Check coding standards
composer lint

# Auto-fix coding standards
composer format
```

Requirements
------------

[](#requirements)

- PHP 8.3+
- WordPress with WP-CLI

License
-------

[](#license)

GPL-3.0-or-later

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance57

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b266fbc7c6022e0bd39e3e1f06d75029dda33bae8d4a109d79824cb6f3bbf18?d=identicon)[dennisenderink](/maintainers/dennisenderink)

![](https://www.gravatar.com/avatar/d1030590f60d21fefa30620a1c50195fa207c5ed67f618326ba6ad781264301c?d=identicon)[omnisite](/maintainers/omnisite)

![](https://www.gravatar.com/avatar/25ddb3567dc50c66226060bf3be9ea79e580f8c16852a021f2b0c007af75d06f?d=identicon)[tmdk](/maintainers/tmdk)

---

Top Contributors

[![dennisenderink](https://avatars.githubusercontent.com/u/329734?v=4)](https://github.com/dennisenderink "dennisenderink (3 commits)")

### Embed Badge

![Health badge](/badges/achttienvijftien-wp-data-migration/health.svg)

```
[![Health](https://phpackages.com/badges/achttienvijftien-wp-data-migration/health.svg)](https://phpackages.com/packages/achttienvijftien-wp-data-migration)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M319](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M18](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
