Make WordPress Core

Ticket #41813: patch.41813.20230608.1.diff

File patch.41813.20230608.1.diff, 1.2 KB (added by ramon fincken, 14 months ago)

patch.41813.20230608.1.diff

  • src/wp-includes/taxonomy.php

     
    41094109                if ( $check_attachments ) {
    41104110                        // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.QuotedDynamicPlaceholderGeneration
    41114111                        $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
    41124116                }
    41134117
    41144118                if ( $object_types ) {