Ticket #41813: patch.41813.20230608.1.diff
File patch.41813.20230608.1.diff, 1.2 KB (added by , 6 months ago) |
---|
-
src/wp-includes/taxonomy.php
4109 4109 if ( $check_attachments ) { 4110 4110 // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.QuotedDynamicPlaceholderGeneration 4111 4111 $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status IN ('" . implode( "', '", $post_statuses ) . "') OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) IN ('" . implode( "', '", $post_statuses ) . "') ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) ); 4112 4113 // Attachments however _can_ have attached taxonomy items to them, count them as well 4114 $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM wp_term_relationships, wp_posts p1 WHERE p1.ID = wp_term_relationships.object_id AND post_status = 'inherit' AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) ); 4115 4112 4116 } 4113 4117 4114 4118 if ( $object_types ) {