diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 2720bbf93a..d8f91aa5db 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -1040,6 +1040,7 @@ case 'set-screen-option': case 'edit_pages_per_page': case 'edit_comments_per_page': case 'upload_per_page': + case 'categories_per_page': $value = (int) $value; if ( $value < 1 || $value > 999 ) die(-1); diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 6669e3daf9..66805f64b3 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -160,15 +160,18 @@ endif; ?> $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0; if ( empty($pagenum) ) $pagenum = 1; -if( ! isset( $catsperpage ) || $catsperpage < 0 ) - $catsperpage = 20; + +$cats_per_page = get_user_option('categories_per_page'); +if ( empty($cats_per_page) ) + $cats_per_page = 20; +$cats_per_page = apply_filters('edit_categories_per_page', $cats_per_page); $page_links = paginate_links( array( 'base' => add_query_arg( 'pagenum', '%#%' ), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), - 'total' => ceil(wp_count_terms('category') / $catsperpage), + 'total' => ceil(wp_count_terms('category') / $cats_per_page), 'current' => $pagenum )); @@ -205,7 +208,7 @@ if ( $page_links )
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 28bfe9bb72..592dd1dcf3 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -3523,6 +3523,9 @@ function screen_options($screen) { case 'upload': $per_page_label = __('Media items per page:'); break; + case 'categories': + $per_page_label = __('Categories per page:'); + break; default: return ''; }