WC_Admin_Log_Table_List::prepare_items
Prepare table list items.
Method of the class: WC_Admin_Log_Table_List{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Admin_Log_Table_List = new WC_Admin_Log_Table_List(); $WC_Admin_Log_Table_List->prepare_items();
Notes
- Global. wpdb. $wpdb
WC_Admin_Log_Table_List::prepare_items() WC Admin Log Table List::prepare items code WC 10.3.3
public function prepare_items() {
global $wpdb;
$this->prepare_column_headers();
$per_page = $this->get_items_per_page(
self::PER_PAGE_USER_OPTION_KEY,
$this->get_per_page_default()
);
$where = $this->get_items_query_where();
$order = $this->get_items_query_order();
$limit = $this->get_items_query_limit();
$offset = $this->get_items_query_offset();
$query_items = "
SELECT log_id, timestamp, level, message, source, context
FROM {$wpdb->prefix}woocommerce_log
{$where} {$order} {$limit} {$offset}
";
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- The query parts are prepared in their respective methods.
$this->items = $wpdb->get_results( $query_items, ARRAY_A );
$total_items = $this->get_total_items_count();
$this->set_pagination_args(
array(
'total_items' => $total_items,
'per_page' => $per_page,
'total_pages' => ceil( $total_items / $per_page ),
)
);
}