From 4e830858061dbe37cda462e9a861bc7401fc6f6b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 27 May 2022 15:49:24 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/post.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index f3300fcf1e..6621d8e090 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -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 {