From 9a1066c90ed9a20275557d73929cb8cbd804aa68 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 23 Jan 2018 11:34:31 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@42565 git-svn-id: http://core.svn.wordpress.org/trunk@42394 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-terms-list-table.php | 26 ++++++++++++------- wp-includes/version.php | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php index c3df053e35..2ba0559a47 100644 --- a/wp-admin/includes/class-wp-terms-list-table.php +++ b/wp-admin/includes/class-wp-terms-list-table.php @@ -377,17 +377,25 @@ class WP_Terms_List_Table extends WP_List_Table { $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; - $edit_link = add_query_arg( - 'wp_http_referer', - urlencode( wp_unslash( $uri ) ), - get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) - ); + $edit_link = get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ); + + if ( $edit_link ) { + $edit_link = add_query_arg( + 'wp_http_referer', + urlencode( wp_unslash( $uri ) ), + $edit_link + ); + $name = sprintf( + '%s', + esc_url( $edit_link ), + /* translators: %s: taxonomy term name */ + esc_attr( sprintf( __( '“%s” (Edit)' ), $tag->name ) ), + $name + ); + } $out = sprintf( - '%s
', - esc_url( $edit_link ), - /* translators: %s: taxonomy term name */ - esc_attr( sprintf( __( '“%s” (Edit)' ), $tag->name ) ), + '%s
', $name ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 789ceea8dc..979c0de69a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42549'; +$wp_version = '5.0-alpha-42565'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.