From e4955f67c27919f03cda147404a63441c6592c28 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 10 Mar 2022 18:20:33 +0000 Subject: [PATCH] Quick/Bulk Edit: Check the `show_in_quick_edit` taxonomy property when populating the data for the posts list table. Previously, setting the `show_in_quick_edit` property to `false` removed the taxonomy from the inline edit form, but the terms were still being populated in the data for each table row via the `get_inline_data()` function, which only checked the `$taxonomy->show_ui` property. This commit: * Improves performance by ensuring that taxonomy terms are not unnecessarily populated for each table row when `show_in_quick_edit` is `false`. * Properly populates the taxonomy terms when `show_in_quick_edit` is `true` and `show_ui` is `false`. Follow-up to [31307]. Props jazbek, figureone, sabernhardt, ovidiul, webcommsat, SergeyBiryukov. Fixes #42916, #49701. git-svn-id: https://develop.svn.wordpress.org/trunk@52841 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/template.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index 32e65f5d77..4fc3b72fef 100644 --- a/src/wp-admin/includes/template.php +++ b/src/wp-admin/includes/template.php @@ -344,7 +344,11 @@ function get_inline_data( $post ) { foreach ( $taxonomy_names as $taxonomy_name ) { $taxonomy = get_taxonomy( $taxonomy_name ); - if ( $taxonomy->hierarchical && $taxonomy->show_ui ) { + if ( ! $taxonomy->show_in_quick_edit ) { + continue; + } + + if ( $taxonomy->hierarchical ) { $terms = get_object_term_cache( $post->ID, $taxonomy_name ); if ( false === $terms ) { @@ -355,7 +359,7 @@ function get_inline_data( $post ) { echo '
' . implode( ',', $term_ids ) . '
'; - } elseif ( $taxonomy->show_ui ) { + } else { $terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name ); if ( ! is_string( $terms_to_edit ) ) {