Ticket #38843: 38843.patch
File 38843.patch, 1.9 KB (added by , 8 years ago) |
---|
-
wp-includes/taxonomy.php
3375 3375 $check_attachments = true; 3376 3376 } 3377 3377 3378 $post_statuses = array( 'publish' ); 3379 3380 /** 3381 * Filters the post statuses for updating the term count. 3382 * 3383 * @param array $post_statuses List of post statuses. 3384 * @param int $taxonomy Current taxonomy object. 3385 */ 3386 $post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) ); 3387 3378 3388 if ( $object_types ) 3379 3389 $object_types = esc_sql( array_filter( $object_types, 'post_type_exists' ) ); 3380 3390 … … 3386 3396 $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 = '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 = 'attachment' AND term_taxonomy_id = %d", $term ) ); 3387 3397 3388 3398 if ( $object_types ) 3389 $count += (int) $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 ) );3399 $count += (int) $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 IN ('" . implode("', '", $post_statuses ) . "') AND post_type IN ('" . implode("', '", $object_types ) . "') AND term_taxonomy_id = %d", $term ) ); 3390 3400 3391 3401 /** This action is documented in wp-includes/taxonomy.php */ 3392 3402 do_action( 'edit_term_taxonomy', $term, $taxonomy->name );