Make WordPress Core

Changeset 52841


Ignore:
Timestamp:
03/10/2022 06:20:33 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r52285 r52841  
    345345        $taxonomy = get_taxonomy( $taxonomy_name );
    346346
    347         if ( $taxonomy->hierarchical && $taxonomy->show_ui ) {
     347        if ( ! $taxonomy->show_in_quick_edit ) {
     348            continue;
     349        }
     350
     351        if ( $taxonomy->hierarchical ) {
    348352
    349353            $terms = get_object_term_cache( $post->ID, $taxonomy_name );
     
    356360            echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>';
    357361
    358         } elseif ( $taxonomy->show_ui ) {
     362        } else {
    359363
    360364            $terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name );
Note: See TracChangeset for help on using the changeset viewer.