[wp-trac] [WordPress Trac] #63562: Term counts should not be recalculated when a post transitions between statuses that are not counted

WordPress Trac noreply at wordpress.org
Mon Jun 16 07:01:08 UTC 2025


#63562: Term counts should not be recalculated when a post transitions between
statuses that are not counted
------------------------------------------------+--------------------------
 Reporter:  johnbillion                         |       Owner:  (none)
     Type:  defect (bug)                        |      Status:  new
 Priority:  normal                              |   Milestone:  Awaiting
                                                |  Review
Component:  Posts, Post Types                   |     Version:
 Severity:  normal                              |  Resolution:
 Keywords:  needs-unit-tests changes-requested  |     Focuses:  performance
------------------------------------------------+--------------------------
Changes (by sandeepdahiya):

 * keywords:  needs-unit-tests has-patch => needs-unit-tests changes-
               requested


Comment:

 > It just needs to respect other statuses added via the
 `update_post_term_count_statuses` filter too.

 @hbhalodia I think the 'update_post_term_count_statuses' filter can be
 used to fetch other statuses as well -
 {{{
         $countable_statuses = apply_filters(
 'update_post_term_count_statuses', array( 'publish' ), null );

         if ( ! in_array( $new_status, $countable_statuses, true )
                 && ! in_array( $old_status, $countable_statuses, true )
         ) {
                 return;
         }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63562#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list