WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#29586 new enhancement

Sync get_the_category_list with get_the_term_list

Reported by: markoheijnen Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.5
Component: Taxonomy Keywords: needs-patch needs-unit-tests
Focuses: Cc:

Description

It would be great to have get_the_term_list() support the same features get_the_category_list() has.

I created a proof of concept patch what works. The only thing I hate is the part I need to specify that I want to have a list instead of a separator because when it's empty get_the_category_list() assumes to show a list but get_the_term_list() will then just show only the links.

Attachments (1)

29586.diff (5.8 KB) - added by markoheijnen 4 years ago.

Download all attachments as: .zip

Change History (4)

@markoheijnen
4 years ago

#1 @boonebgorges
4 years ago

  • Keywords needs-patch needs-unit-tests added; has-patch dev-feedback removed

This would be pretty great. I'd feel more comfortable with it if either of these functions had any unit test coverage.

Moving the call to get_category_parents() into get_the_term_list() is problematic, because get_category_parents() is compatible only with categories. This would probably have to be accompanied by a taxonomy-agnostic get_term_parents() (with get_category_parents() converted to a wrapper).

#2 @markoheijnen
4 years ago

I totally missed get_category_parents. I will work on the improvements this week and then also add unit tests.

#3 @boonebgorges
3 years ago

  • Milestone changed from Awaiting Review to Future Release
Note: See TracTickets for help on using tickets.