WordPress.org

Make WordPress Core

Changeset 42565


Ignore:
Timestamp:
01/23/2018 11:33:26 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Taxonomy: Don't display an empty edit link in taxonomy list table if the user doesn't have permissions to edit the term.

Props grapplerulrich.
Fixes #43146.

File:
1 edited

Legend:

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

    r42343 r42565  
    378378        $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
    379379
    380         $edit_link = add_query_arg(
    381             'wp_http_referer',
    382             urlencode( wp_unslash( $uri ) ),
    383             get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type )
    384         );
     380        $edit_link = get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type );
     381
     382        if ( $edit_link ) {
     383            $edit_link = add_query_arg(
     384                'wp_http_referer',
     385                urlencode( wp_unslash( $uri ) ),
     386                $edit_link
     387            );
     388            $name = sprintf(
     389                '<a class="row-title" href="%s" aria-label="%s">%s</a>',
     390                esc_url( $edit_link ),
     391                /* translators: %s: taxonomy term name */
     392                esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
     393                $name
     394            );
     395        }
    385396
    386397        $out = sprintf(
    387             '<strong><a class="row-title" href="%s" aria-label="%s">%s</a></strong><br />',
    388             esc_url( $edit_link ),
    389             /* translators: %s: taxonomy term name */
    390             esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
     398            '<strong>%s</strong><br />',
    391399            $name
    392400        );
Note: See TracChangeset for help on using the changeset viewer.