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

WordPress Trac noreply at wordpress.org
Thu Nov 20 10:44:08 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):

 Replying to [comment:6 ChriCo]:
 > On your current patch: 30415.diff
 >
 > L1399
 > > @return string|WP_Error A list of category parents on success,
 WP_Error on failure.
 >
 > why then `return false;` ? :-) Wheres the `new WP_Error` ?
 >
 > L1421
 > > $chain .= get_category_parents( $parent->parent, $link, $separator,
 $nicename, $visited );
 >
 > shouldn't you call `get_term_parents()` ?
 >
 > and a note from my side: Wouldn't it better to implement a function (
 `get_term_parent_tree()`) which returns the a tree (array) with parent =>
 child ? Instead we should implement a function called
 `get_term_parent_list_html()`.
 Good point about the boolean return there - will generate  a WP_Error in
 that case. Will fix up the other incorrect category references too -
 thanks for pointing that out :)

 In terms of generating an array instead of the markup - that would be
 solid I think. For this patch I was simply improving the existing
 function, but you're right it would actually be better to have the
 functionality more split like that - I guess that's in the scope of this
 patch too, so will work on that, but will fix the other issues in the mean
 time first.

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


More information about the wp-trac mailing list