Make WordPress Core

Changeset 15108


Ignore:
Timestamp:
06/02/2010 02:55:33 PM (14 years ago)
Author:
ryan
Message:

Make _pad_term_counts custom post type aware. Props reko. fixes #13670

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r15065 r15108  
    23762376function _pad_term_counts(&$terms, $taxonomy) {
    23772377    global $wpdb;
    2378 
     2378error_log("here $taxonomy");
    23792379    // This function only works for hierarchical taxonomies like post categories.
    23802380    if ( !is_taxonomy_hierarchical( $taxonomy ) )
     
    23942394
    23952395    // Get the object and term ids and stick them in a lookup table
    2396     $results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (".join(',', array_keys($term_ids)).") AND post_type = 'post' AND post_status = 'publish'");
     2396    $tax_obj = get_taxonomy($taxonomy);
     2397    $object_types = esc_sql($tax_obj->object_type);
     2398    $results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (" . implode(',', array_keys($term_ids)) . ") AND post_type IN ('" . implode("', '", $object_types) . "') AND post_status = 'publish'");
    23972399    foreach ( $results as $row ) {
    23982400        $id = $term_ids[$row->term_taxonomy_id];
Note: See TracChangeset for help on using the changeset viewer.