WordPress.org

Make WordPress Core

Ticket #17548: 17548.diff

File 17548.diff, 1.4 KB (added by joehoyle, 3 years ago)
  • wp-includes/post.php

     
    27262726        $post->post_status = 'publish'; 
    27272727        wp_transition_post_status('publish', $old_status, $post); 
    27282728 
    2729         // Update counts for the post's terms. 
    2730         foreach ( (array) get_object_taxonomies('post') as $taxonomy ) { 
    2731                 $tt_ids = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'tt_ids')); 
    2732                 wp_update_term_count($tt_ids, $taxonomy); 
    2733         } 
    2734  
    27352729        do_action('edit_post', $post_id, $post); 
    27362730        do_action('save_post', $post_id, $post); 
    27372731        do_action('wp_insert_post', $post_id, $post); 
     
    29692963 * @param object $post Post data. 
    29702964 */ 
    29712965function wp_transition_post_status($new_status, $old_status, $post) { 
     2966 
     2967        // Update counts for the post's terms. 
     2968        foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) { 
     2969                if( empty( get_taxonomy( $taxonomy )->update_count_callback ) ) 
     2970                        continue; 
     2971 
     2972                $tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids ') ); 
     2973                wp_update_term_count( $tt_ids, $taxonomy ); 
     2974        } 
     2975 
    29722976        do_action('transition_post_status', $new_status, $old_status, $post); 
    29732977        do_action("{$old_status}_to_{$new_status}", $post); 
    29742978        do_action("{$new_status}_{$post->post_type}", $post->ID, $post);