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.

git-svn-id: https://develop.svn.wordpress.org/trunk@53449 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-05-27 15:49:24 +00:00
parent 15deb80e50
commit 4e83085806

View File

@ -597,8 +597,14 @@ function bulk_edit_posts( $post_data = null ) {
$post = get_post( $post_ID );
$tax_names = get_object_taxonomies( $post );
foreach ( $tax_names as $tax_name ) {
$taxonomy_obj = get_taxonomy( $tax_name );
if ( ! $taxonomy_obj->show_in_quick_edit ) {
continue;
}
if ( isset( $tax_input[ $tax_name ] ) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) {
$new_terms = $tax_input[ $tax_name ];
} else {