[wp-trac] [WordPress Trac] #38280: Make term count for a specific object type available
WordPress Trac
noreply at wordpress.org
Thu Jun 22 03:43:56 UTC 2017
#38280: Make term count for a specific object type available
--------------------------------------+------------------------------
Reporter: desrosj | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Comment (by boonebgorges):
[attachment:38280.6.diff] does some formatting cleanup, including some
slight reorganization of `return` statements in
`wp_get_term_count_for_object_type()` to reduce the amount of `if`
indentation.
This reorganization shows that there are some cases in which
`wp_get_term_count_for_object_type()` doesn't return a value at all.
Should we be returning 0 as a default value? The fact that these cases
didn't come up makes me think we're missing some cases in the unit tests.
Can you explain this logic to me?
{{{
* If the object type has been counted, and other counts exist in
meta, we can
* assume this term has 0 relationships for this object type.
}}}
Why is it necessary to check for *other* counts? Shouldn't it be enough
for the type to be listed in `_wp_counted_object_types`? If there's a
scenario where these values might get out of whack, we should (a) have a
test that describes it, and/or (b) defend against that scenario :)
The invalidation part is looking pretty good to me.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38280#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list