WordPress.org

Make WordPress Core

Ticket #18986: 18986.patch

File 18986.patch, 1.2 KB (added by SergeyBiryukov, 3 years ago)
  • wp-includes/taxonomy.php

     
    28552855                // Attachments can be 'inherit' status, we need to base count off the parent's staus if so 
    28562856                if ( in_array( 'attachment', $object_types ) ) 
    28572857                        $count = $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 = 'publish' OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) = 'publish' ) ) AND post_type IN ('" . implode("', '", $object_types) . "') AND term_taxonomy_id = %d", $term ) ); 
     2858                elseif ( in_array( 'link', $object_types ) ) 
     2859                        $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) ); 
    28582860                else 
    28592861                        $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type IN ('" . implode("', '", $object_types) . "') AND term_taxonomy_id = %d", $term ) ); 
    28602862