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 3e682c778c..f6697f13a9 100644 --- a/src/wp-admin/includes/class-wp-terms-list-table.php +++ b/src/wp-admin/includes/class-wp-terms-list-table.php @@ -292,27 +292,32 @@ class WP_Terms_List_Table extends WP_List_Table { break; } - if ( $term->parent != $parent && empty( $_REQUEST['s'] ) ) { + if ( $term->parent !== $parent && empty( $_REQUEST['s'] ) ) { continue; } // If the page starts in a subtree, print the parents. - if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { + if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { $my_parents = array(); $parent_ids = array(); $p = $term->parent; + while ( $p ) { $my_parent = get_term( $p, $taxonomy ); $my_parents[] = $my_parent; $p = $my_parent->parent; + if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops. break; } + $parent_ids[] = $p; } + unset( $parent_ids ); $num_parents = count( $my_parents ); + while ( $my_parent = array_pop( $my_parents ) ) { echo "\t"; $this->single_row( $my_parent, $level - $num_parents ); @@ -474,6 +479,7 @@ class WP_Terms_List_Table extends WP_List_Table { ); $actions = array(); + if ( current_user_can( 'edit_term', $tag->term_id ) ) { $actions['edit'] = sprintf( '%s', @@ -489,6 +495,7 @@ class WP_Terms_List_Table extends WP_List_Table { __( 'Quick Edit' ) ); } + if ( current_user_can( 'delete_term', $tag->term_id ) ) { $actions['delete'] = sprintf( '%s', @@ -498,6 +505,7 @@ class WP_Terms_List_Table extends WP_List_Table { __( 'Delete' ) ); } + if ( is_taxonomy_viewable( $tax ) ) { $actions['view'] = sprintf( '%s', @@ -603,9 +611,11 @@ class WP_Terms_List_Table extends WP_List_Table { */ public function column_links( $tag ) { $count = number_format_i18n( $tag->count ); + if ( $count ) { $count = "$count"; } + return $count; }