[wp-trac] [WordPress Trac] #24386: Make _pad_term_counts work for non-post type objects and attachments

WordPress Trac noreply at wordpress.org
Mon Jan 19 17:10:16 UTC 2015


#24386: Make _pad_term_counts work for non-post type objects and attachments
------------------------------------------+-----------------------------
 Reporter:  TomAuger                      |       Owner:
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  Future Release
Component:  Taxonomy                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+-----------------------------
Changes (by boonebgorges):

 * milestone:  Awaiting Review => Future Release


Comment:

 Circling back around to this, I think I agree that we should be using
 `$term->count`, and not doing a separate database query. I'm not sure why
 the query was ever necessary; see [6159], [6087], [4707] for some relevant
 history. The 'post_type' information does not seem important, since only
 the proper object_types should be reflected in the 'count' field; likewise
 for the 'post_status' check.

 The key will be to write some unit tests that verify that the 'count'
 field is correctly recalculated on 'transition_post_status'. This should
 already be happening at `_update_term_count_on_transition_post_status()`,
 and the term count callback functions (`_update_post_term_count()` and
 `_update_generic_term_count()`) should already be accounting for
 post_type/post_status stuff, but this needs verification via tests.

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


More information about the wp-trac mailing list