[wp-trac] [WordPress Trac] #39940: get_terms(): post_type arguments

WordPress Trac noreply at wordpress.org
Wed Feb 22 13:55:05 UTC 2017


#39940: get_terms(): post_type arguments
----------------------------+-----------------------------
 Reporter:  Compute         |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Taxonomy        |    Version:  4.7.2
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 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/

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39940>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list