Make WordPress Core

Changeset 53449


Ignore:
Timestamp:
05/27/2022 03:49:24 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Quick/Bulk Edit: Check the show_in_quick_edit taxonomy property when processing the data for bulk edited posts.

Previously, setting the show_in_quick_edit property to false removed the taxonomy from the inline edit form, but several taxonomy-related database queries were still being performed in bulk_edit_posts() when building the arguments to pass to wp_update_post(), even though terms were not modified.

This commit improves performance by avoiding unnecessary database queries when show_in_quick_edit is false, and mirrors a similar check in the get_inline_data() function.

Follow-up to [13535], [14580], [31307], [52841], [53368].

Props Chouby, sabernhardt, costdev, nalininonstopnewsuk, webcommsat, marybaum, meher, wparslan, SergeyBiryukov.
Fixes #42474.

File:
1 edited

Legend:

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

    r53299 r53449  
    598598        $post      = get_post( $post_ID );
    599599        $tax_names = get_object_taxonomies( $post );
     600
    600601        foreach ( $tax_names as $tax_name ) {
    601602            $taxonomy_obj = get_taxonomy( $tax_name );
     603
     604            if ( ! $taxonomy_obj->show_in_quick_edit ) {
     605                continue;
     606            }
     607
    602608            if ( isset( $tax_input[ $tax_name ] ) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) {
    603609                $new_terms = $tax_input[ $tax_name ];
Note: See TracChangeset for help on using the changeset viewer.