diff --git a/includes/admin/class-wc-admin-api-keys-table-list.php b/includes/admin/class-wc-admin-api-keys-table-list.php index b4df72c7fa4..a521d560b9d 100644 --- a/includes/admin/class-wc-admin-api-keys-table-list.php +++ b/includes/admin/class-wc-admin-api-keys-table-list.php @@ -2,10 +2,8 @@ /** * WooCommerce API Keys Table List * - * @author WooThemes - * @category Admin - * @package WooCommerce/Admin - * @version 2.4.0 + * @package WooCommerce\Admin + * @version 2.4.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -177,7 +175,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table { public function prepare_items() { global $wpdb; - $per_page = apply_filters( 'woocommerce_api_keys_settings_items_per_page', 10 ); + $per_page = $this->get_items_per_page( 'wc_api_keys_per_page' ); $columns = $this->get_columns(); $hidden = array(); $sortable = $this->get_sortable_columns(); diff --git a/includes/admin/class-wc-admin-api-keys.php b/includes/admin/class-wc-admin-api-keys.php index 6df9aa252ea..9f58f307070 100644 --- a/includes/admin/class-wc-admin-api-keys.php +++ b/includes/admin/class-wc-admin-api-keys.php @@ -2,10 +2,8 @@ /** * WooCommerce Admin API Keys Class * - * @author WooThemes - * @category Admin - * @package WooCommerce/Admin - * @version 2.4.0 + * @package WooCommerce\Admin + * @version 2.4.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -22,6 +20,7 @@ class WC_Admin_API_Keys { */ public function __construct() { add_action( 'admin_init', array( $this, 'actions' ) ); + add_action( 'woocommerce_settings_page_init', array( $this, 'screen_option' ) ); } /** @@ -54,11 +53,22 @@ class WC_Admin_API_Keys { } } + /** + * Add screen option. + */ + public function screen_option() { + if ( ! isset( $_GET['create-key'], $_GET['edit-key'] ) && $this->is_api_keys_settings_page() ) { + add_screen_option( 'per_page', array( + 'default' => 10, + 'option' => 'wc_api_keys_per_page', + ) ); + } + } + /** * Table list output. */ private static function table_list_output() { - global $wpdb; echo '