Make WordPress Core


Ignore:
Timestamp:
03/08/2019 03:36:04 PM (7 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r44574 r44822  
    11271127                        $terms           = get_the_terms( $post->ID, $taxonomy );
    11281128                        if ( is_array( $terms ) ) {
    1129                                 $out = array();
     1129                                $term_links = array();
    11301130                                foreach ( $terms as $t ) {
    11311131                                        $posts_in_term_qv = array();
     
    11411141
    11421142                                        $label = esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) );
    1143                                         $out[] = $this->get_edit_link( $posts_in_term_qv, $label );
     1143
     1144                                        $term_links[] = $this->get_edit_link( $posts_in_term_qv, $label );
    11441145                                }
     1146
     1147                                /**
     1148                                 * Filters the links in `$taxonomy` column of edit.php.
     1149                                 *
     1150                                 * @since 5.2.0
     1151                                 *
     1152                                 * @param array  $term_links List of links to edit.php, filtered by the taxonomy term.
     1153                                 * @param string $taxonomy   Taxonomy name.
     1154                                 * @param array  $terms      Array of terms appearing in the post row.
     1155                                 */
     1156                                $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms );
     1157
    11451158                                /* translators: used between list items, there is a space after the comma */
    1146                                 echo join( __( ', ' ), $out );
     1159                                echo join( __( ', ' ), $term_links );
    11471160                        } else {
    11481161                                echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>';
Note: See TracChangeset for help on using the changeset viewer.