#39940 closed defect (bug) (duplicate)
get_terms(): post_type arguments
Reported by: | Compute | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7.2 |
Component: | Taxonomy | Keywords: | |
Focuses: | administration | Cc: |
Description
When a taxonomy is shared across multiple post_types these are counted as a total of both.
For instance:
My custom category "discipline" is used on the post_types "course" and "summer_course".
On one discipline the courses have 4 and the summer_courses have 7. In the backend the count is then "11" but when clicking the link on the course discipline I see only 4.
Another bad thing about this is how hide_empty is working. If the courses has 6 courses with a discipline but summer_courses don't, the get_terms() will shown the discipline as not empty. It would be nice to specify which post_types should be including.
I've found this solution but I really think that there should be a fix for more core as well:
https://dfactory.eu/get_terms-post-type/
Duplicate of #18106, see also #38280 and #32942.