From 9a2a423eb6858cbd96017c2ce877e35604073ca5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 27 May 2022 15:51:12 +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. Built from https://develop.svn.wordpress.org/trunk@53449 git-svn-id: http://core.svn.wordpress.org/trunk@53038 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/post.php | 6 ++++++ wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index f3300fcf1e..6621d8e090 100644 --- a/wp-admin/includes/post.php +++ b/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 { diff --git a/wp-includes/version.php b/wp-includes/version.php index 1b1cc616cf..64cf35cd96 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53448'; +$wp_version = '6.1-alpha-53449'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.