-
Notifications
You must be signed in to change notification settings - Fork 0
WP CLI Commands
gotowebpl edited this page Jan 15, 2026
·
1 revision
ShadowORM provides a comprehensive set of WP-CLI commands for managing shadow tables.
| Command | Description |
|---|---|
wp shadow status |
Show migration status for all types |
wp shadow migrate |
Migrate posts to shadow tables |
wp shadow rollback |
Remove shadow table for a type |
wp shadow benchmark |
Run performance benchmark |
Shows the current state of shadow tables.
wp shadow status+------------+-------+----------+--------+--------+
| Post Type | Total | Migrated | Size | Driver |
+------------+-------+----------+--------+--------+
| post | 150 | 150 | 1.2 MB | MySQL8 |
| page | 25 | 25 | 0.3 MB | MySQL8 |
| product | 500 | 500 | 5.6 MB | MySQL8 |
+------------+-------+----------+--------+--------+
| Column | Description |
|---|---|
| Post Type | WordPress post type |
| Total | Number of published posts |
| Migrated | Number of posts in shadow table |
| Size | Disk space used by shadow table |
| Driver | MySQL8 or Legacy |
Migrates posts to shadow tables.
| Option | Description | Default |
|---|---|---|
--type=<type> |
Post type to migrate | Required (unless --all) |
--all |
Migrate all supported types | false |
--batch=<num> |
Batch size for migration | 500 |
--dry-run |
Preview without changes | false |
# Migrate specific post type
wp shadow migrate --type=post
# Migrate all supported types
wp shadow migrate --all
# Custom batch size (for large sites)
wp shadow migrate --type=product --batch=1000
# Preview what would happen
wp shadow migrate --all --dry-run$ wp shadow migrate --type=product
Migrating product 100% [████████████████████████████████] 500/500 2.3s
Success: Migrated 500 posts of type 'product'| Site Size | Posts | Recommended Batch |
|---|---|---|
| Small | < 1,000 | 500 (default) |
| Medium | 1,000 - 10,000 | 1,000 |
| Large | > 10,000 | 2,000 |
Removes shadow table for a post type.
| Option | Description | Required |
|---|---|---|
--type=<type> |
Post type to rollback | Yes |
$ wp shadow rollback --type=product
This will delete shadow table for 'product'. Continue? [y/n] y
Success: Shadow table for 'product' dropped- Rollback deletes all data from the shadow table
- WordPress will fall back to
wp_postmetafor reads - Re-migration is required to use shadow tables again
Runs a simple performance benchmark.
| Option | Description | Default |
|---|---|---|
--type=<type> |
Post type to benchmark | post |
--iterations=<num> |
Number of iterations | 10 |
$ wp shadow benchmark --type=product --iterations=100
Benchmark results for 100 iterations:
Average: 0.342 ms
Min: 0.218 ms
Max: 0.567 ms| Metric | Description |
|---|---|
| Average | Mean query time |
| Min | Fastest query |
| Max | Slowest query |
| Driver | Average Time |
|---|---|
| MySQL8 | < 0.5ms |
| Legacy | < 1.0ms |
| Error | Cause | Solution |
|---|---|---|
| "Specify --type or --all" | Missing argument | Add --type=post or --all |
| "No posts found" | Empty shadow table | Run migrate first |
| "Table does not exist" | Not migrated | Run migrate for this type |
$ wp shadow migrate
Error: Specify --type=<post_type> or --all#!/bin/bash
# migrate-all.sh
for type in post page product; do
wp shadow migrate --type=$type --batch=1000
done
wp shadow status#!/bin/bash
# Check if all posts are migrated
wp shadow status | grep -q " 0 " && echo "Warning: Some types not migrated"#!/bin/bash
# Pre-deployment script
# Run dry-run first
wp shadow migrate --all --dry-run
# If okay, run actual migration
wp shadow migrate --all --batch=500High-performance ORM layer for WordPress/WooCommerce
- Home - Overview and features
- Installation - Setup instructions
- Getting Started - Quick start guide
- Configuration - Settings reference
- WP-CLI Commands - Command reference
- Architecture - Technical design
- How It Works - Internal workings
- API Reference - Developer API
- Troubleshooting - Problem solving
- FAQ - Common questions
Links