[wp-trac] [WordPress Trac] #53319: Add support for a "reverse" argument in get_term_parents_list() function

WordPress Trac noreply at wordpress.org
Wed Jun 2 14:53:33 UTC 2021


#53319: Add support for a "reverse" argument in get_term_parents_list() function
-------------------------+------------------------------
 Reporter:  bedas        |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------------------

Comment (by bedas):

 @joyously afaik, the get_ancestors function returns An array of IDs of
 ancestors from lowest to highest in the hierarchy.

 Thus, Because the get_ancestors doesn’t provide the current/start term and
 that term is added within get_term_parents_list only and it’s added at the
 begin of the terms list, if you invert the array in get_ancestors you
 would get Child Category/Parent Category/Grandchild Category as a result
 of get_term_parents_list

 Maybe I’m wrong but this is what I saw in the code

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


More information about the wp-trac mailing list