[wp-trac] [WordPress Trac] #30415: Allow get_category_parents() to be used for any taxonomy

WordPress Trac noreply at wordpress.org
Thu Nov 20 12:41:25 UTC 2014


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

Comment (by hlashbrooke):

 I've modified the solution to include two new functions instead - both
 included in {{{taxonomy.php}}}:
 * {{{get_term_parents()}}} - returns an array of parent term IDs
 * {{{get_term_parents_html()}}} - return an HTML string of term parents in
 hierarchical order

 {{{get_category_parents()}}} is now a wrapper for
 {{{get_term_parents_html()}}}, which in turn calls
 {{{get_term_parents()}}} to fetch the array from which to generate the
 HTML. This means that everything is still backwards compatible.

 I named {{{get_term_parents()}}} as such in order to mimic the naming
 convention already in place with {{{get_term_children()}}}.

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


More information about the wp-trac mailing list