From 87f0a73bdcd6f9201905d4f263723f7789c53ff7 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 12 Jun 2015 18:54:56 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@32739 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-terms-list-table.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-terms-list-table.php b/src/wp-admin/includes/class-wp-terms-list-table.php index f903cb5aaf..c061fa6412 100644 --- a/src/wp-admin/includes/class-wp-terms-list-table.php +++ b/src/wp-admin/includes/class-wp-terms-list-table.php @@ -223,7 +223,7 @@ class WP_Terms_List_Table extends WP_List_Table { } $terms = get_terms( $taxonomy, $args ); - if ( empty( $terms ) ) { + if ( empty( $terms ) || ! is_array( $terms ) ) { echo ''; $this->no_items(); echo ''; @@ -239,7 +239,6 @@ class WP_Terms_List_Table extends WP_List_Table { // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count ); } else { - $terms = get_terms( $taxonomy, $args ); foreach ( $terms as $term ) { $this->single_row( $term ); }