Recent

Stats_Command class Pro only

Stats_Command

Statistics management commands for Better Search.

Namespace: WebberZone\Better_Search\Pro\CLI
Since: 4.3.0
Source: includes/cli/class-stats-command.php line 23 Extends: Base_Command

Methods

view()

View search statistics.

OPTIONS

[—limit=] : Number of entries to show. Default: 20

[—table=

] : Table to query (overall, daily). Default: overall

[—orderby=] : Order by field (searchvar, cntaccess, dp_date). Default: cntaccess

[—order=] : Sort order (asc, desc). Default: desc

[—format=] : Output format (table, json, csv). Default: table

[—url=] : Specific site URL to view stats for (multisite only).

[—network] : View stats for all sites in the network.

[—blog-id=] : Specific blog ID to view stats for (multisite only).

EXAMPLES

wp bsearch stats view
wp bsearch stats view --limit=50
wp bsearch stats view --table=daily --orderby=dp_date
wp bsearch stats view --format=json
wp bsearch stats view --network
wp bsearch stats view --blog-id=2

Line: 67

public function view( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void

top()

Show top search queries.

OPTIONS

[—limit=] : Number of top searches to show. Default: 20

[—format=] : Output format (table, json, csv). Default: table

[—url=] : Specific site URL to view stats for (multisite only).

[—network] : View stats for all sites in the network.

[—blog-id=] : Specific blog ID to view stats for (multisite only).

EXAMPLES

wp bsearch stats top
wp bsearch stats top --limit=50
wp bsearch stats top --network

Line: 178

public function top( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void

clear()

Clear search statistics.

OPTIONS

[—before=] : Clear entries before this date (YYYY-MM-DD format).

[—table=

] : Which table to clear (overall, daily, all). Default: all

[—force] : Skip confirmation.

[—dry-run] : Show what would be cleared without making changes.

EXAMPLES

wp bsearch stats clear --force
wp bsearch stats clear --before=2024-01-01
wp bsearch stats clear --table=daily --dry-run

Line: 210

public function clear( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void

export()

Export search statistics to CSV.

OPTIONS

[—file=] : Path to export file. Default: bsearch-stats-{timestamp}.csv

[—table=

] : Table to export (overall, daily). Default: overall

[—limit=] : Maximum number of entries to export. Default: all

EXAMPLES

wp bsearch stats export
wp bsearch stats export --file=stats.csv
wp bsearch stats export --table=daily --limit=1000

Line: 318

public function export( array $args, array $assoc_args ): void;
TypeNameDescription
array$argsCommand arguments.
array$assoc_argsCommand associative arguments.

Returns: void