array key: get_data_count

returns: integer

The get_data_count functionality returns the total count of rows returned in the list table for display and pagination. This count should take into account the search terms and WHERE clauses but ignore pagination, the query is similar to the get_data query without pagination.

WordPress $wpdb documentation available at https://codex.wordpress.org/Class_Reference/wpdb

$list_table_definitions['get_data_count'] = 'saturn_tables_cars_return_items_count';
function saturn_tables_cars_return_items_count() {

    global $wpdb;

    $where_clause[] =  1;
    if (isset($_GET['status'])) {
        $status = ($_GET['status'] == "trash") ? 1 : 0;
        $where_clause[] =  "status = $status";
    }
    if (isset($_GET['s'])) {
        $search = esc_sql($_GET['s']);
        $where_clause[] =  "CONCAT_WS(' ', make, model) LIKE '%$search%'";
    }
    if (isset($_GET['make'])) {
        $make = esc_sql($_GET['make']);
        $where_clause[] =  ($make == "All Makes") ? 1 : "make = '$make'";
    }
    $where_clause = implode(" AND ", $where_clause);

    $query = "SELECT count(*) FROM saturn_tables_cars WHERE $where_clause";

    return  $wpdb->get_var($query);

}