Make WordPress Core

Ticket #54181: 54181.2.patch

File 54181.2.patch, 1.2 KB (added by mattoakley, 3 years ago)

Patch hides bulk edit options in terms list if no terms are found, patch includes more accurate doc blocks

  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    2222        private $level;
    2323
    2424        /**
     25         * Total items
     26         *
     27         * @var int
     28         * @since 5.9.0
     29         */
     30        private $total_items = 0;
     31
     32        /**
    2533         * Constructor.
    2634         *
    2735         * @since 3.1.0
     
    127135
    128136                $this->callback_args = $args;
    129137
     138                $this->total_items = wp_count_terms(
     139                        array(
     140                                'taxonomy' => $this->screen->taxonomy,
     141                                'search'   => $search,
     142                        )
     143                );
     144
    130145                $this->set_pagination_args(
    131146                        array(
    132                                 'total_items' => wp_count_terms(
    133                                         array(
    134                                                 'taxonomy' => $this->screen->taxonomy,
    135                                                 'search'   => $search,
    136                                         )
    137                                 ),
     147                                'total_items' => $this->total_items,
    138148                                'per_page'    => $tags_per_page,
    139149                        )
    140150                );
     
    141151        }
    142152
    143153        /**
     154         * Determines if the current screen has results
     155         *
     156         * @since 5.9.0
    144157         * @return bool
    145158         */
    146159        public function has_items() {
    147                 // @todo Populate $this->items in prepare_items().
    148                 return true;
     160                return (int) $this->total_items > 0 ? true : false;
    149161        }
    150162
    151163        /**