Make WordPress Core


Ignore:
Timestamp:
09/26/2011 10:24:46 PM (15 years ago)
Author:
ryan
Message:

Count only published posts when updating term counts. Fire term count updates on transition_post_status. Props joehoyle. fixes #17548

File:
1 edited

Legend:

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

    r18661 r18783  
    24462446        } else {
    24472447                // Default count updater
    2448                 foreach ( (array) $terms as $term) {
    2449                         $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) );
    2450                         do_action( 'edit_term_taxonomy', $term, $taxonomy );
    2451                         $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
    2452                         do_action( 'edited_term_taxonomy', $term, $taxonomy );
    2453                 }
    2454 
     2448                _update_post_term_count( $terms, $taxonomy );
    24552449        }
    24562450
Note: See TracChangeset for help on using the changeset viewer.