Make WordPress Core

Ticket #54521: 54521-taxonomy-term-quick-edit.diff

File 54521-taxonomy-term-quick-edit.diff, 1.5 KB (added by panagiotis.synetos, 3 years ago)
  • src/wp-admin/includes/ajax-actions.php

    From 4b73fa30b035deeccd8df0930ce41d7943a89394 Mon Sep 17 00:00:00 2001
    From: "Panos (Panagiotis) Synetos" <panos.synetos@git.wordpress.org>
    Date: Thu, 16 Dec 2021 15:26:33 +0200
    Subject: [PATCH] Fix taxonomy term quick edit not saving if taxonomy has
     non-latin characters
    
    ---
     src/wp-admin/includes/ajax-actions.php | 15 +++++++--------
     1 file changed, 7 insertions(+), 8 deletions(-)
    
    diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
    index 1ba480f2f1..26aa352268 100644
    a b function wp_ajax_inline_save() { 
    20972097function wp_ajax_inline_save_tax() {
    20982098        check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
    20992099
    2100         $taxonomy = sanitize_key( $_POST['taxonomy'] );
    2101         $tax      = get_taxonomy( $taxonomy );
    2102 
    2103         if ( ! $tax ) {
    2104                 wp_die( 0 );
    2105         }
    2106 
    21072100        if ( ! isset( $_POST['tax_ID'] ) || ! (int) $_POST['tax_ID'] ) {
    21082101                wp_die( -1 );
    21092102        }
    function wp_ajax_inline_save_tax() { 
    21142107                wp_die( -1 );
    21152108        }
    21162109
     2110        // Get the tag just by ID, without the taxonomy argument and then get the taxonomy from the tag.
     2111        $tag = get_term( $id );
     2112        if ( ! $tag || is_wp_error( $tag ) ) {
     2113                wp_die( 0 );
     2114        }
     2115        $taxonomy = $tag->taxonomy;
     2116
    21172117        $wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) );
    21182118
    2119         $tag                  = get_term( $id, $taxonomy );
    21202119        $_POST['description'] = $tag->description;
    21212120
    21222121        $updated = wp_update_term( $id, $taxonomy, $_POST );