[wp-trac] [WordPress Trac] #30941: Get taxonomy terms by post ID and order/orderby

WordPress Trac noreply at wordpress.org
Wed Jan 7 14:32:07 UTC 2015


#30941: Get taxonomy terms by post ID and order/orderby
-----------------------------+-----------------------------
 Reporter:  miyarakira       |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Taxonomy         |    Version:  4.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 I have a situation where I need to get taxonomy terms, optionally by
 associated post ID, and sorted by order/orderby.

 The issue:

 * ''get_terms'' accepts order/orderby (and other parameters) but not post
 ID, as far as I could see
 * ''get_the_terms'' accepts post ID but not order/orderby.

 So when I need the terms by post ID, I can't have them sorted.
 [[http://wordpress.stackexchange.com/questions/137926/sorting-attributes-
 order-when-using-get-the-terms|Here]]'s another person who wanted to sort
 by term slug, and the recommendation was to sort them manually after
 ''get_the_terms''.

 I read the Codex on both functions and looked into their respective code:
 ''get_terms'' in ''taxonomy.php'', and ''get_the_terms'' in ''category-
 template.php''.  Is it possible to achieve what I want currently?  If not,
 it would be helpful to have either:

 1) order/orderby in get_the_terms
 2) post_id in get_terms

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


More information about the wp-trac mailing list