mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-30 20:21:37 +01:00
Taxonomy: Restrict term edit link generation in WP_Terms_List_Table::handle_row_actions()
.
This changeset restricts edit term link generation if the user lacks the `edit_term` cap in order to prevent PHP 8.1+ deprecations shown when a user lacks this capability and `get_edit_term_link()` returns null. Props thelovekesh, jrf. Fixes #59336. Built from https://develop.svn.wordpress.org/trunk@56631 git-svn-id: http://core.svn.wordpress.org/trunk@56143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d761ed56ca
commit
25b109a0e5
@ -474,18 +474,18 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||
$taxonomy = $this->screen->taxonomy;
|
||||
$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, $taxonomy, $this->screen->post_type )
|
||||
);
|
||||
|
||||
$actions = array();
|
||||
|
||||
if ( current_user_can( 'edit_term', $tag->term_id ) ) {
|
||||
$actions['edit'] = sprintf(
|
||||
'<a href="%s" aria-label="%s">%s</a>',
|
||||
esc_url( $edit_link ),
|
||||
esc_url(
|
||||
add_query_arg(
|
||||
'wp_http_referer',
|
||||
urlencode( wp_unslash( $uri ) ),
|
||||
get_edit_term_link( $tag, $taxonomy, $this->screen->post_type )
|
||||
)
|
||||
),
|
||||
/* translators: %s: Taxonomy term name. */
|
||||
esc_attr( sprintf( __( 'Edit “%s”' ), $tag->name ) ),
|
||||
__( 'Edit' )
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-alpha-56630';
|
||||
$wp_version = '6.4-alpha-56631';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user