WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#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:
PR Number:

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/

Change History (2)

#1 @SergeyBiryukov
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #18106, see also #38280 and #32942.

#2 @Compute
3 years ago

Thanks for the links!

Note: See TracTickets for help on using tickets.