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.

Built from https://develop.svn.wordpress.org/trunk@32739


git-svn-id: http://core.svn.wordpress.org/trunk@32710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-06-12 18:55:25 +00:00
parent da4c3d0fe4
commit d0aa8e4a6e
2 changed files with 2 additions and 3 deletions

View File

@ -223,7 +223,7 @@ class WP_Terms_List_Table extends WP_List_Table {
} }
$terms = get_terms( $taxonomy, $args ); $terms = get_terms( $taxonomy, $args );
if ( empty( $terms ) ) { if ( empty( $terms ) || ! is_array( $terms ) ) {
echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">'; echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
$this->no_items(); $this->no_items();
echo '</td></tr>'; echo '</td></tr>';
@ -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 // 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 ); $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count );
} else { } else {
$terms = get_terms( $taxonomy, $args );
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
$this->single_row( $term ); $this->single_row( $term );
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-32738'; $wp_version = '4.3-alpha-32739';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.