From 401d3c1b517d0c3c48f197dbbad995ea69f1153b Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 8 Mar 2019 15:37:52 +0000 Subject: [PATCH] Taxonomy: Introduce `post_column_taxonomy_links`. This filter allows plugin developers to modify the markup for the links in taxonomy columns on edit.php. Props DaveFX. Fixes #42669. Built from https://develop.svn.wordpress.org/trunk@44822 git-svn-id: http://core.svn.wordpress.org/trunk@44654 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-posts-list-table.php | 19 ++++++++++++++++--- wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index c16b9a8ed4..00c4b7b146 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -1126,7 +1126,7 @@ class WP_Posts_List_Table extends WP_List_Table { $taxonomy_object = get_taxonomy( $taxonomy ); $terms = get_the_terms( $post->ID, $taxonomy ); if ( is_array( $terms ) ) { - $out = array(); + $term_links = array(); foreach ( $terms as $t ) { $posts_in_term_qv = array(); if ( 'post' != $post->post_type ) { @@ -1140,10 +1140,23 @@ class WP_Posts_List_Table extends WP_List_Table { } $label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ); - $out[] = $this->get_edit_link( $posts_in_term_qv, $label ); + + $term_links[] = $this->get_edit_link( $posts_in_term_qv, $label ); } + + /** + * Filters the links in `$taxonomy` column of edit.php. + * + * @since 5.2.0 + * + * @param array $term_links List of links to edit.php, filtered by the taxonomy term. + * @param string $taxonomy Taxonomy name. + * @param array $terms Array of terms appearing in the post row. + */ + $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms ); + /* translators: used between list items, there is a space after the comma */ - echo join( __( ', ' ), $out ); + echo join( __( ', ' ), $term_links ); } else { echo '' . $taxonomy_object->labels->no_terms . ''; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 52e05d9a21..b7beaf480e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.2-alpha-44821'; +$wp_version = '5.2-alpha-44822'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.