WordPress at Your Fingertips
function is not described

WC_Admin_Log_Table_List::prepare_items() public WC 1.0

Prepare table list items.

{} It's a method of the class: WC_Admin_Log_Table_List{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Admin_Log_Table_List = new WC_Admin_Log_Table_List();
$WC_Admin_Log_Table_List->prepare_items();

Notes

  • Global. wpdb. $wpdb

Code of WC_Admin_Log_Table_List::prepare_items() WC 5.8.0

public function prepare_items() {
	global $wpdb;

	$this->prepare_column_headers();

	$per_page = $this->get_items_per_page( 'woocommerce_status_log_items_per_page', 10 );

	$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
		FROM {$wpdb->prefix}woocommerce_log
		{$where} {$order} {$limit} {$offset}
	";

	$this->items = $wpdb->get_results( $query_items, ARRAY_A );

	$query_count = "SELECT COUNT(log_id) FROM {$wpdb->prefix}woocommerce_log {$where}";
	$total_items = $wpdb->get_var( $query_count );

	$this->set_pagination_args(
		array(
			'total_items' => $total_items,
			'per_page'    => $per_page,
			'total_pages' => ceil( $total_items / $per_page ),
		)
	);
}