Make WordPress Core

Ticket #44821: 44821.4.diff

File 44821.4.diff, 1.9 KB (added by SergeyBiryukov, 8 years ago)
  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    7777        /**
    7878         */
    7979        public function prepare_items() {
    80                 $tags_per_page = $this->get_items_per_page( 'edit_' . $this->screen->taxonomy . '_per_page' );
     80                $taxonomy      = $this->screen->taxonomy;
     81                $tags_per_page = $this->get_items_per_page( "edit_{$taxonomy}_per_page" );
    8182
    82                 if ( 'post_tag' === $this->screen->taxonomy ) {
     83                /**
     84                 * Filters the number of terms displayed per page for a specific taxonomy.
     85                 *
     86                 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy.
     87                 *
     88                 * Some examples of filter hooks generated here include: 'edit_post_tag_per_page',
     89                 * 'edit_category_per_page', 'edit_link_category_per_page', etc.
     90                 *
     91                 * @since 4.9.9
     92                 *
     93                 * @param int $tags_per_page Number of terms to be displayed. Default 20.
     94                 */
     95                $tags_per_page = apply_filters( "edit_{$taxonomy}_per_page", $tags_per_page );
     96
     97                if ( 'post_tag' === $taxonomy ) {
    8398                        /**
    8499                         * Filters the number of terms displayed per page for the Tags list table.
    85100                         *
    … …  
    98113                         * @param int $tags_per_page Number of tags to be displayed. Default 20.
    99114                         */
    100115                        $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page );
    101                 } elseif ( 'category' === $this->screen->taxonomy ) {
     116                } elseif ( 'category' === $taxonomy ) {
    102117                        /**
    103118                         * Filters the number of terms displayed per page for the Categories list table.
    104119                         *
    … …  
    129144
    130145                $this->set_pagination_args(
    131146                        array(
    132                                 'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ),
     147                                'total_items' => wp_count_terms( $taxonomy, compact( 'search' ) ),
    133148                                'per_page'    => $tags_per_page,
    134149                        )
    135150                );