WP-CLI
The plugin ships several WP-CLI commands for development, testing, and operations.
Setup
WP-CLI is available on most managed WordPress hosts. To install locally:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
Verify: wp --info
wp wkafw seed
Demo data seeders for testing. Defined in Wkafw_CLI_Seed.
Standard auctions
wp wkafw seed standard --count=5 --with-bids
| Flag | Default | Effect |
|---|---|---|
--count | 5 | Number of auctions to create |
--with-bids | false | Generate bids on each auction |
--users | 10 | Number of test users to create |
--cleanup | false | Remove demo data first |
Multi-vendor
wp wkafw seed vendors --count=3 --auctions-per-vendor=2
Requires an active multi-vendor plugin.
Charity event
wp wkafw seed charity-event
Creates an event with 10 charity-type lots, with donor entries.
Penny auctions
wp wkafw seed penny --packs=true
Creates 3 penny auctions and bid packs for 5 users.
Full demo store
wp wkafw seed full-store
Combines all seeders. Useful for taking screenshots / demos.
Cleanup
wp wkafw seed cleanup
Removes every row tagged _wkafw_demo = yes. Safe to run repeatedly.
wp wkafw audit
Audit log management.
Verify chain integrity
wp wkafw audit verify
wp wkafw audit verify --since=24h
Walks the bid hash chain and reports OK or the first sequence number where the hash breaks.
Export
wp wkafw audit export --format=json > audit.json
wp wkafw audit export --format=csv --since=2026-01-01 > audit.csv
| Format | Use case |
|---|---|
json | Programmatic / archival |
csv | Accounting / spreadsheet |
signed | HMAC-signed bundle (legal evidence) |
Prune
wp wkafw audit prune --before=2026-01-01
Permanent — confirms before deleting. Re-anchors the chain head.
wp wkafw bids
List bids
wp wkafw bids list --auction=123
wp wkafw bids list --user=42 --status=active --format=json
Place a bid
wp wkafw bids place --auction=123 --user=42 --amount=5500
Useful for stress-testing concurrent bid handling.
Retract
wp wkafw bids retract --bid=4567
wp wkafw auctions
List
wp wkafw auctions list --status=active --format=table
Create
wp wkafw auctions create \
--product-id=789 \
--type=standard \
--start-price=100 \
--reserve-price=500 \
--end-date="2026-06-01 18:00:00"
Status changes
wp wkafw auctions start --id=123
wp wkafw auctions pause --id=123
wp wkafw auctions extend --id=123 --seconds=600
wp wkafw auctions end --id=123
wp wkafw auctions cancel --id=123
Bulk operations
wp wkafw auctions bulk-end --status=ended --before=2026-01-01
wp wkafw auctions bulk-relist --status=failed
wp wkafw wallet
Balance
wp wkafw wallet balance --user=42
Credit / debit
wp wkafw wallet credit --user=42 --amount=100 --note="Refund for #123"
wp wkafw wallet debit --user=42 --amount=50 --note="Manual debit"
Recompute
wp wkafw wallet recompute --all
wp wkafw wallet recompute --user=42
Recomputes balance from ledger. Useful after manual data fixes.
wp wkafw db
Migrations
wp wkafw db migrate # run any pending migrations
wp wkafw db migrate --force # re-run all migrations
wp wkafw db version # show current schema version
Schema check
wp wkafw db verify
Compares actual schema vs expected. Reports missing columns / indexes.
Optimize
wp wkafw db optimize
Runs OPTIMIZE TABLE on every plugin table.
wp wkafw export
CSV exports of any plugin data, scriptable.
wp wkafw export auctions --status=ended > ended-auctions.csv
wp wkafw export bids --auction=123 > bids-123.csv
wp wkafw export wallet-ledger --user=42 > ledger-42.csv
wp wkafw export disputes --status=open > open-disputes.csv
wp wkafw cron
Manually fire scheduled cron jobs (useful for debugging).
wp wkafw cron run wkafw_check_auctions
wp wkafw cron run wkafw_send_ending_soon_emails
wp wkafw cron run wkafw_audit_log_prune_cron
List scheduled jobs:
wp wkafw cron list
wp wkafw settings
wp wkafw settings get wkafw_default_poll_interval
wp wkafw settings set wkafw_default_poll_interval 15
wp wkafw settings list # all wkafw_ options
wp wkafw settings reset # reset to defaults (confirms)
wp wkafw settings export > settings.json
wp wkafw settings import < settings.json
wp wkafw cache
wp wkafw cache flush # all plugin caches
wp wkafw cache flush --auction=123 # specific auction
wp wkafw cache warm # pre-populate hot data
Hooks
// Add a custom CLI command
add_action( 'cli_init', function() {
if ( class_exists( 'WP_CLI' ) ) {
WP_CLI::add_command( 'wkafw my-cmd', function( $args, $assoc ) {
WP_CLI::success( 'Custom command ran' );
} );
}
} );
Common workflows
"Reset a staging environment for fresh testing"
wp wkafw seed cleanup
wp wkafw db migrate --force
wp wkafw seed full-store
"Run a load test against the bidding engine"
# Create one auction
AUCTION=$(wp wkafw auctions create --product-id=1 --start-price=10 --end-date="+1 hour" --porcelain)
# Spawn 100 concurrent bids
for i in {1..100}; do
wp wkafw bids place --auction=$AUCTION --user=$((RANDOM % 50 + 1)) --amount=$((10 + i)) &
done
wait
# Check audit chain integrity
wp wkafw audit verify
"Migrate from staging to production"
# On staging
wp wkafw settings export > settings.json
# On production
wp wkafw settings import < settings.json
wp wkafw db migrate
wp wkafw cache flush
"Generate a quarterly compliance report"
wp wkafw audit export \
--format=signed \
--since="$(date -d '3 months ago' '+%Y-%m-%d')" \
> q1-2026-audit.signed.json
wp wkafw export wallet-ledger > q1-2026-wallet.csv
Performance
CLI commands bypass the HTTP request pipeline (no nonce, no caching, no rate-limiting). Useful for:
- Bulk operations (1000+ auctions)
- Cron jobs running outside WP-Cron
- Recovery operations after data corruption
Be careful — CLI commands can trigger the same hooks as web requests (notifications, webhooks, etc.). For silent operations, use --no-hooks.
Common questions
"Why doesn't wp wkafw appear in the help list?"
WP-CLI loads commands when the plugin is active. Verify with wp plugin status auctions-for-woocommerce.
"Can I run these on managed hosting?"
Most managed hosts support WP-CLI. Some (Kinsta, WP Engine) only allow it via SSH. Check with your host.
"Are there destructive commands?"
wp wkafw seed cleanup, wp wkafw audit prune, wp wkafw settings reset, wp wkafw db migrate --force are all destructive. Each prompts for confirmation; use --yes to skip in scripts.
