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.
Built from https://develop.svn.wordpress.org/trunk@52841


git-svn-id: http://core.svn.wordpress.org/trunk@52430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-03-10 18:22:01 +00:00
parent 12134c3435
commit c771c6a79d
2 changed files with 7 additions and 3 deletions

View File

@ -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 '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>';
} elseif ( $taxonomy->show_ui ) {
} else {
$terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name );
if ( ! is_string( $terms_to_edit ) ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52840';
$wp_version = '6.0-alpha-52841';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.