Make WordPress Core

Changeset 60365

Timestamp:
06/29/2025 10:25:13 PM (3 months ago)
Author:
johnbillion
Message:

Taxonomy: Avoid unnecessarily recalculating term counts when a post is updated and its status is unchanged.

If the terms of the post are changed then the term recounting is still handled by wp_update_term_count() inside wp_set_object_terms().

Props pbearne, johnbillion, peterwilsoncc, Chouby

Fixes #42522

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r60360 r60365  
    81718171 */
    81728172function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) {
     8173    if ( $new_status === $old_status ) {
     8174        return;
     8175    }
     8176
    81738177    // Update counts for the post's terms.
    81748178    foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
Note: See TracChangeset for help on using the changeset viewer.