[wp-trac] [WordPress Trac] #30415: Add alternative to get_category_parents() that will work for any taxonomy

WordPress Trac noreply at wordpress.org
Thu Jan 29 21:02:11 UTC 2015


#30415: Add alternative to get_category_parents() that will work for any taxonomy
----------------------------------------+------------------------------
 Reporter:  hlashbrooke                 |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Taxonomy                    |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+------------------------------

Comment (by boonebgorges):

 Thanks for the patches so far.

 I understand the motivation behind breaking `get_term_parents()` into a
 separate function from `get_term_parents_html()`. But this creates a
 disparity between `get_category_parents()`, which returns a string, and
 `get_term_parents()`, which returns an array of parents.

 If we're going to have a general tool for getting ancestors of a term, I'd
 rather have it be a new parameter for `get_terms()`, and it would be more
 efficient for it to work by fetching the cached hierarchy with
 `_get_term_hierarchy()` instead of crawling backward with a `while` loop.
 (Notwithstanding what `get_category_parents()` already does :) )

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30415#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list