WP-CLI Commands
WB Listora ships two CLI command namespaces - wp listora (Free) and wp listora-pro (Pro) - for the operations admins do most: directory statistics, search-index rebuilds, imports, exports, competitor migrations, database repair, and demo content management. Use them whenever the admin UI’s PHP max_execution_time would cap a large operation, or when scripting deployments.
What it is
Section titled “What it is”Both namespaces register at WP_CLI::add_command() and extend \WP_CLI_Command. Discoverable from any shell with WP-CLI installed: wp listora lists Free subcommands; wp listora-pro lists Pro subcommands.
Free namespace - wp listora
Section titled “Free namespace - wp listora”10 subcommands, every one matching includes/class-cli-commands.php.
# Statistics + healthwp listora stats # Directory totals, index sync %, DB table sizeswp listora repair # Clean orphaned search_index + geo rows (--dry-run supported)wp listora reindex # Rebuild search_index for all listingswp listora reindex --type=restaurant # Reindex one listing typewp listora reindex --batch-size=500 --dry-run # Preview without writing
# Email + maintenance (since 1.1.0)wp listora test-email # List the available notification templateswp listora test-email listing_approved --to=you@example.com # Send one template to verify rendering + deliverywp listora cleanup # Run the daily housekeeping cron now (email-log + analytics retention, stale unverified listings)
# Repair (since 1.5.0) - report first, act only when askedwp listora repair-locations # Show listings whose location terms were lost, change nothingwp listora repair-locations --format=csv # Same list, as CSVwp listora repair-locations --execute # Actually restore themwp listora repair-credit-ledger # Show ledger rows needing a compensating adjustmentwp listora repair-credit-ledger --execute # Write the adjustments
# Type registrywp listora listing-types # Table of registered types: slug, name, field count, schema
# CSV import / exportwp listora import listings.csv --type=restaurantwp listora import listings.csv --type=restaurant --dry-runwp listora export # Default: publish status, all types, dated filenamewp listora export --type=restaurant --output=restaurants.csvwp listora export --status=pending --output=pending.csv
# Competitor migration (any of 4 sources)wp listora migrate --from=directoristwp listora migrate --from=geodirectory --dry-runwp listora migrate --from=bdp --batch-size=25wp listora migrate --from=listingpro
# Demo contentwp listora demo seed # All 9 packs + test users (default)wp listora demo seed --pack=restaurant # One pack onlywp listora demo seed --pack=restaurant,hotel # Multiple packswp listora demo seed --pack=all --with-users --reindexwp listora demo seed --pack=classified --skip-imageswp listora demo remove # Removes only listings tagged _listora_demo_contentwp listora demo reseed --pack=restaurant # Remove + re-seed in one goCommon flags
Section titled “Common flags”| Flag | Subcommands | Purpose |
|---|---|---|
--type=<slug> |
reindex, import, export | Restrict to a specific listing type. |
--to=<email> |
test-email | Recipient address. Defaults to the site admin email. |
--status=<status> |
export | Post status filter. Default publish. |
--batch-size=<N> |
reindex, migrate | Override default batch size (500 reindex, 50 migrate). Lower for memory-constrained servers. |
--dry-run |
reindex, import, repair, migrate | Preview without writing. |
--output=<path> |
export | Output file path. Default listora-export-YYYY-MM-DD.csv. |
--from=<source> |
migrate | One of: directorist, geodirectory, bdp, listingpro. |
--pack=<slug> |
demo seed/reseed | Comma-separated or all. Available: restaurant, hotel, real-estate, job-board, general, classified, education, healthcare, place. |
--with-users |
demo seed/reseed | Also create the four default test users (contributor1, author1, subscriber2, subscriber3). |
--skip-images |
demo seed/reseed | Skip image sideloading. Useful for CI / slow networks. |
--reindex |
demo seed/reseed | Run Search_Indexer::batch_reindex() after seeding. |
The repair commands
Section titled “The repair commands”Both repair commands are dry-run by default. Running one reports what it would change and modifies nothing; only --execute writes. That is deliberate - a repair that guesses wrong on a live directory is worse than the problem it fixes, so you get to read the candidate list first.
repair-locationsfinds listings whose location terms were lost and restores them from the stored address data.repair-credit-ledgerfinds ledger rows that need a compensating adjustment and writes those adjustments rather than editing history. The credit ledger is append-only by design, so a repair adds a correcting row; it never rewrites a past one.
Both accept --format=table|csv|json|count.
Pro namespace - wp listora-pro
Section titled “Pro namespace - wp listora-pro”1 subcommand, matching wb-listora-pro/includes/class-cli-commands.php.
# Demo QA dataset (full Pro overlay - moderators, badges, plans, coupons, needs, webhooks, audit log)wp listora-pro demo seedwp listora-pro demo seed --reindex # Run wp listora reindex after seedingwp listora-pro demo seed --skip-images # Skip Picsum photo-review sideloadwp listora-pro demo seed --user-id=42 # Use a specific user as primary actorwp listora-pro demo removePro flags
Section titled “Pro flags”| Flag | Purpose |
|---|---|
--reindex |
After seeding, refresh the Free search index. |
--skip-images |
Skip Picsum image sideload for photo reviews (faster, offline-safe). |
--user-id=<id> |
Use a specific user as primary actor. When omitted the seeder provisions three QA test users (pro-vendor, pro-moderator, pro-customer). |
Pro management operations that the previous version of this doc claimed as CLI commands (license activate/deactivate, webhooks, credit ledger, audit-log export, feature toggles, pages ensure) are admin-UI only - they’re not exposed via WP-CLI. Use the Settings page or the REST API instead.
How you use it
Section titled “How you use it”Common scripted workflows
Section titled “Common scripted workflows”# Onboard a fresh staging clone end-to-end (Free + Pro demo data)wp listora demo seed --pack=all --with-users --reindexwp listora-pro demo seed --reindex
# Health check before an upgradewp listora stats # Confirm sync % is at 100; flag if notwp listora repair --dry-run # Preview orphan rows; run without --dry-run to clean
# Bulk import 50K listings without the UI hitting max_execution_timewp listora import huge-file.csv --type=restaurant
# Reindex after editing field configurationwp listora reindex --type=restaurant --batch-size=200
# Competitor migration with safety previewwp listora migrate --from=directorist --dry-run # See row count + samplewp listora migrate --from=directorist # Run for real
# Reseed demo content after seeder improvementswp listora demo reseed --pack=all --with-users --reindex
# Verify mail delivery + template rendering after an SMTP changewp listora test-email listing_approved --to=you@example.com
# Force the daily housekeeping cron immediately (fires wb_listora_daily_cleanup)wp listora cleanupBypass behaviour
Section titled “Bypass behaviour”WP-CLI execution automatically bypasses:
- CAPTCHA - admins running imports shouldn’t be CAPTCHA’d.
- Rate limits - bulk imports don’t trip the per-IP submission cap.
- Required-login REST permission callbacks - CLI runs as the system, not as a user.
This is documented behaviour, not a backdoor: WP-CLI execution already requires shell access to the server, a much stronger gate than CAPTCHA or per-IP windows.
Adding your own subcommands
Section titled “Adding your own subcommands”Add subcommands to either namespace without forking by registering on WP_CLI:
add_action( 'cli_init', function () {WP_CLI::add_command( 'listora my-custom', 'My_Custom_CLI' );} );
class My_Custom_CLI {
/*** Check geo-coverage of all listings.** ## EXAMPLES** wp listora my-custom check-geo-coverage*/public function check_geo_coverage( $args, $assoc_args ) {global $wpdb;$covered = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}listora_geo" );$total = (int) wp_count_posts( 'listora_listing' )->publish;WP_CLI::success( sprintf( 'Geo coverage: %d / %d (%.1f%%)', $covered, $total, ( $total ? $covered / $total * 100 : 0 ) ) );}}Then: wp listora my-custom check-geo-coverage.
Settings & options
Section titled “Settings & options”| Class | Namespace | Subcommands |
|---|---|---|
WBListora\CLI_Commands (Free) |
wp listora |
stats, reindex, test-email, cleanup, listing-types, import, export, repair, migrate, demo |
WBListoraPro\CLI_Commands (Pro) |
wp listora-pro |
demo |
CLI commands fire the same hooks as the equivalent admin / REST actions - wb_listora_after_create_listing, wb_listora_listing_status_changed, wb_listora_pro_credits_added, etc. - so listeners (notifications, audit log, outgoing webhooks) work uniformly whether the action came from a UI click, a REST call, or a CLI script.
Related
Section titled “Related”- Import & Export - customer-facing CSV / JSON / GeoJSON import-export UI and CLI equivalents.
- Competitor migration guides - step-by-step for each supported source.
- REST API - what CLI commands operate on at the data layer; many CLI flows also have a REST equivalent.
- Custom Fields - reindex after changing field configuration.

