Make WordPress Core

Opened 6 years ago

Last modified 6 years ago

#42522 new defect (bug)

Terms are uselessly counted when saving a post

Reported by: chouby's profile Chouby Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.3
Component: Taxonomy Keywords: has-patch
Focuses: performance Cc:


This occurs even when terms have not been modified and when the post status has not changed. This is due to _update_term_count_on_transition_post_status not checking if the post status has been modified.

Attachments (1)

42522.diff (950 bytes) - added by Chouby 6 years ago.

Download all attachments as: .zip

Change History (4)

6 years ago

#1 @Chouby
6 years ago

  • Keywords has-patch added

#2 @johnbillion
6 years ago

  • Keywords reporter-feedback added

What about the situation where a published post gets its terms changed but the status doesn't change? It looks like this change would cause the term count for newly added terms to get out of sync.

#3 @Chouby
6 years ago

  • Keywords reporter-feedback removed

In that case, wp_set_object_terms calls wp_update_term_count, so the term count should be correctly udpated.

Note: See TracTickets for help on using tickets.