Make WordPress Core

Ticket #42522: 42522.diff

File 42522.diff, 950 bytes (added by Chouby, 6 years ago)
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 1dbf0c9..ac2ded9 100644
    a b function wp_queue_posts_for_term_meta_lazyload( $posts ) { 
    61866186 * @param WP_Post $post       Post object.
    61876187 */
    61886188function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) {
    6189         // Update counts for the post's terms.
    6190         foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
    6191                 $tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) );
    6192                 wp_update_term_count( $tt_ids, $taxonomy );
     6189        if ( $new_status !== $old_status ) {
     6190                // Update counts for the post's terms.
     6191                foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
     6192                        $tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) );
     6193                        wp_update_term_count( $tt_ids, $taxonomy );
     6194                }
    61936195        }
    61946196}
    61956197