--- a/wp/wp-admin/includes/class-wp-terms-list-table.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/includes/class-wp-terms-list-table.php Wed Sep 21 18:19:35 2022 +0200
@@ -129,7 +129,12 @@
$this->set_pagination_args(
array(
- 'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ),
+ 'total_items' => wp_count_terms(
+ array(
+ 'taxonomy' => $this->screen->taxonomy,
+ 'search' => $search,
+ )
+ ),
'per_page' => $tags_per_page,
)
);
@@ -166,7 +171,7 @@
* @return string
*/
public function current_action() {
- if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) ) {
+ if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && 'delete' === $_REQUEST['action'] ) {
return 'bulk-delete';
}
@@ -287,27 +292,32 @@
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 );
@@ -469,6 +479,7 @@
);
$actions = array();
+
if ( current_user_can( 'edit_term', $tag->term_id ) ) {
$actions['edit'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>',
@@ -484,6 +495,7 @@
__( 'Quick Edit' )
);
}
+
if ( current_user_can( 'delete_term', $tag->term_id ) ) {
$actions['delete'] = sprintf(
'<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>',
@@ -493,6 +505,7 @@
__( 'Delete' )
);
}
+
if ( is_taxonomy_viewable( $tax ) ) {
$actions['view'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>',
@@ -521,6 +534,11 @@
*
* The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
*
+ * Possible hook names include:
+ *
+ * - `category_row_actions`
+ * - `post_tag_row_actions`
+ *
* @since 3.0.0
*
* @param string[] $actions An array of action links to be displayed. Default
@@ -593,9 +611,11 @@
*/
public function column_links( $tag ) {
$count = number_format_i18n( $tag->count );
+
if ( $count ) {
$count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
}
+
return $count;
}
@@ -611,6 +631,11 @@
* The dynamic portion of the hook name, `$this->screen->taxonomy`,
* refers to the slug of the current taxonomy.
*
+ * Possible hook names include:
+ *
+ * - `manage_category_custom_column`
+ * - `manage_post_tag_custom_column`
+ *
* @since 2.8.0
*
* @param string $string Blank string.