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

WordPress Trac noreply at wordpress.org
Thu Nov 20 08:46:11 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:  General      |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 The {{{get_category_parents()}}} function is, as the name suggests,
 limited to only fetching the parents for the {{{category}}} taxonomy. It
 would be great if we had the same function available for any specified
 taxonomy to use.

 My suggested patch (attached) adds a new function,
 {{{get_term_parents()}}}, which is a direct copy of the existing function,
 but with an added {{{$taxonomy}}} parameter so you can use it for any
 given taxonomy. I have then updated the original
 {{{get_category_parents()}}} to simply be a wrapper for this new function,
 so it is fully backwards compatible.

 The only modification to the original function (aside from some coding
 standards updates) is the addition of an {{{is_taxonomy_hierarchical()}}}
 check, which now becomes necessary.

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


More information about the wp-trac mailing list