Make WordPress Core


Ignore:
Timestamp:
06/12/2015 06:54:56 PM (9 years ago)
Author:
wonderboymusic
Message:

In WP_Terms_List_Table::display_rows_or_placeholder():

  • get_terms() can return WP_Error, so its return value should be checked before traversing.
  • The 2nd call to get_terms() can be removed, it is redundant #OPTIMIZATION

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-terms-list-table.php

    r32669 r32739  
    224224        $terms = get_terms( $taxonomy, $args );
    225225
    226         if ( empty( $terms ) ) {
     226        if ( empty( $terms ) || ! is_array( $terms ) ) {
    227227            echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
    228228            $this->no_items();
     
    240240            $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count );
    241241        } else {
    242             $terms = get_terms( $taxonomy, $args );
    243242            foreach ( $terms as $term ) {
    244243                $this->single_row( $term );
Note: See TracChangeset for help on using the changeset viewer.