WC_Admin_Post_Types::setup_screen()
Looks at the current screen and loads the correct list table handler.
Method of the class: WC_Admin_Post_Types{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Admin_Post_Types = new WC_Admin_Post_Types(); $WC_Admin_Post_Types->setup_screen();
Changelog
Since 3.3.0 | Introduced. |
WC_Admin_Post_Types::setup_screen() WC Admin Post Types::setup screen code WC 9.7.1
public function setup_screen() { global $wc_list_table; $request_data = $this->request_data(); $screen_id = false; if ( function_exists( 'get_current_screen' ) ) { $screen = get_current_screen(); $screen_id = isset( $screen, $screen->id ) ? $screen->id : ''; } if ( ! empty( $request_data['screen'] ) ) { $screen_id = wc_clean( wp_unslash( $request_data['screen'] ) ); } switch ( $screen_id ) { case 'edit-shop_order': include_once __DIR__ . '/list-tables/class-wc-admin-list-table-orders.php'; $wc_list_table = new WC_Admin_List_Table_Orders(); break; case 'edit-shop_coupon': include_once __DIR__ . '/list-tables/class-wc-admin-list-table-coupons.php'; $wc_list_table = new WC_Admin_List_Table_Coupons(); break; case 'edit-product': include_once __DIR__ . '/list-tables/class-wc-admin-list-table-products.php'; $wc_list_table = new WC_Admin_List_Table_Products(); break; } // Ensure the table handler is only loaded once. Prevents multiple loads if a plugin calls check_ajax_referer many times. remove_action( 'current_screen', array( $this, 'setup_screen' ) ); remove_action( 'check_ajax_referer', array( $this, 'setup_screen' ) ); }