Statistics_Table
Better_Search_Statistics_Table class.
Display the popular search terms in a tabular format.
Namespace: WebberZone\Better_Search\Admin
Since: 3.3.0
Source: includes/admin/class-statistics-table.php line 24
Extends: WP_List_Table
Methods
__construct()
Class constructor.
Line: 48
public function __construct( $network_wide = ... );
| Type | Name | Description |
|---|---|---|
bool |
$network_wide |
Whether to show network-wide data. |
get_network_query_results() static
Run a network statistics query with one safe recovery attempt.
If a table was removed outside WordPress after the network table cache was built, the first query can fail. Clear the stale registry, rediscover tables live, rebuild the UNION fragments, and retry once. A second failure returns the supplied fallback so an admin dashboard request remains usable.
Since: 4.4.3
Line: 72
static public function get_network_query_results( $query_callback, $fallback = ... ): mixed;
| Type | Name | Description |
|---|---|---|
callable |
$query_callback |
Query callback that rebuilds SQL on every invocation. |
mixed |
$fallback |
Value returned after an unsuccessful recovery attempt. |
Returns: mixed — Query result or fallback value.
clear_network_table_unions_cache() static
Clear the in-request network UNION cache.
Since: 4.4.3
Line: 104
static public function clear_network_table_unions_cache( );
get_popular_searches()
Retrieve the Better Search search terms
Line: 117
public function get_popular_searches( $per_page = ..., $page_number = ..., $args = ... ): array;
| Type | Name | Description |
|---|---|---|
int |
$per_page |
Posts per page. |
int |
$page_number |
Page number. |
array |
$args |
Array of arguments. |
Returns: array — Array of popular search terms
get_network_table_unions() static
Get UNION SQL fragments for a table across all network sites.
Since: 4.3.0
Line: 265
static public function get_network_table_unions( $table_suffix ): array;
| Type | Name | Description |
|---|---|---|
string |
$table_suffix |
Table name suffix (e.g., ‘bsearch’ or ‘bsearch_daily’). |
Returns: array — Array of SELECT SQL strings for UNION.
delete_search_entry() static
Delete search result.
Line: 304
static public function delete_search_entry( $id );
| Type | Name | Description |
|---|---|---|
string |
$id |
Search result. |
record_count()
Returns the count of records in the database.
Line: 330
public function record_count( $args = ... ): int;
| Type | Name | Description |
|---|---|---|
array |
$args |
Array of arguments. |
Returns: int — Number of records.
no_items()
Text displayed when no post data is available
Line: 376
public function no_items( );
column_default()
Render a column when no column specific method exist.
Line: 389
public function column_default( $item, $column_name ): mixed;
| Type | Name | Description |
|---|---|---|
array |
$item |
Current item. |
string |
$column_name |
Column name. |
Returns: mixed
column_cb()
Render the checkbox column.
Line: 406
public function column_cb( $item ): string;
| Type | Name | Description |
|---|---|---|
array |
$item |
Current item. |
Returns: string
column_title()
Render the title column.
Line: 420
public function column_title( $item ): string;
| Type | Name | Description |
|---|---|---|
array |
$item |
Current item. |
Returns: string
get_columns()
Associative array of columns
Line: 458
public function get_columns( ): array;
Returns: array
get_sortable_columns()
Columns to make sortable.
Line: 481
public function get_sortable_columns( ): array;
Returns: array
get_bulk_actions()
Returns an associative array containing the bulk action
Line: 495
public function get_bulk_actions( ): array;
Returns: array
prepare_items()
Handles data query and filter, sorting, and pagination.
Line: 508
public function prepare_items( );
process_bulk_action()
Handles any bulk actions
Line: 549
public function process_bulk_action( );
extra_tablenav()
Adds extra navigation elements to the table.
Line: 623
public function extra_tablenav( $which );
| Type | Name | Description |
|---|---|---|
string |
$which |
Which part of the table are we. |