Better Search Pro CLI (BSP-CLI) was introduced in Better Search Pro v4.3.0, allowing you to manage search operations without touching the admin dashboard. If you’re running large-scale WordPress installations or automating deployments, these commands handle everything from cache warming to database maintenance.
About WP-CLI
WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installations, and much more, all without using a web browser. For more information, visit the official WP-CLI websiteOpens in a new window.
Getting Started with BSP-CLI
To begin using BSP-CLI, ensure that WP-CLI is installed and that you are running Better Search Pro 4.3.0 or later. The CLI commands are accessed through the wp bsearch command. For a complete list of available commands, type wp bsearch in your command-line interface.
Command Structure
All commands use the wp bsearch namespace:
Available Commands
Search
Run search queries directly from the command line.
Basic Search
Options
--limit=<number>: Number of results (default: 10)--post-type=<types>: Comma-separated post types (default: post)--[no-]use-fulltext: Force FULLTEXT search ON or OFF--[no-]boolean-mode: Use boolean mode for FULLTEXT ON or OFF--format=<format>: Output format: table, json, csv (default: table)--verbose: Show detailed output
Examples
Status
Show comprehensive plugin status and configuration.
Options:
--format=<format>: Output format: table, json, csv--verbose: Show detailed information--network: Show status for all network sites
Cache
Manage the search results cache.
Clear Cache
Options:
--network: Clear cache for all sites in the network--force: Skip confirmation--dry-run: Preview without making changes--verbose: Show detailed output
Warm Cache
Pre-generate search results for your most popular queries.
Options:
--limit=<number>: Number of top searches to warm (default: 50)--batch-size=<size>: Batch size for processing (default: 100)--dry-run: Preview without making changes--force: Force cache warming even if cache exists
Cache Status
Options:
--format=<format>: Output format: table, json, csv
Efficient Content Storage and Indexing (ECSI)
Manage the custom search tables used by Efficient Content Storage and Indexing.
Status
Options:
--format=<format>: Output format: table, json, csv. Default: table--network: Show status for all sites in the network
Enable and disable
Turns ECSI on or off. Without options, the current site is changed.
Options:
--network: Apply to all sites in the network (multisite only)--blog-id=<id>: Apply to a specific site (multisite only)
Reindex
Indexes published posts into the custom tables.
Options:
--force: Empty the tables before reindexing--batch-size=<size>: Posts processed per batch, from 1 to 1000. Default: 100--post-type=<types>: Comma-separated post types to index. Default: all public post types--dry-run: Show what would be indexed without making changes--verbose: Show per-post output instead of a progress bar--network: Reindex all sites in the network (multisite only)
Each post that cannot be written is reported as a warning. From Better Search Pro 4.5.3, the command finishes processing every selected site, then exits with an error when any post failed, so scripts and deployments can detect an incomplete index. The failed posts are listed under Better Search → Tools, where you can retry them after fixing the database problem.
Create and drop tables
create creates the custom tables; --dry-run shows what would be created. drop permanently deletes the custom tables and asks for confirmation unless --force is supplied.
AI Answers
Inspect and operate Better Search Pro AI Answers from WP-CLI.
AI Status
The status includes whether AI Answers is enabled, provider availability, selected and fallback providers, provider cooldown state, cached-answer count, today’s provider requests, the daily cap, and the number of recorded questions.
Check Provider
Force a live provider availability check:
Ask a Question
The command uses the configured provider chain and returns the answer, sources, cache state, and failure reason.
Clear the AI Cache
This removes cached answers and provider state.
Content Gaps
The list command supports --from, --to, --limit, --page, and --format. Export supports CSV and JSON. Clear deletes every recorded question and prompts for confirmation unless --yes is supplied.

WP-CLI commands in Top 10 Pro