[wp-trac] [WordPress Trac] #24562: get_the_terms is not zero indexed array

WordPress Trac noreply at wordpress.org
Tue Jun 11 22:01:09 UTC 2013


#24562: get_the_terms is not zero indexed array
-------------------------+-----------------------------
 Reporter:  leedo        |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Taxonomy     |    Version:  3.5.1
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 The return value of `get_the_terms` only says it returns an array. To me,
 this implies that it is an array of terms, beginning at index 0. In fact,
 it is closer to an associative array, using the term's ID as the key. Some
 documentation to this effect would be very useful. Or returning a simple
 array.

 Expected return value:
 {{{
 array(1) {
   [0]=>
   object(stdClass)#1032 (10) {
     ["term_id"]=>
     string(4) "1274"
     ["name"]=>
     string(10) "Staff Blog"
     ["slug"]=>
     string(5) "blogs"
     ["term_group"]=>
     string(1) "0"
     ["term_taxonomy_id"]=>
     string(4) "1284"
     ["taxonomy"]=>
     string(13) "ars_post_type"
     ["description"]=>
     string(0) ""
     ["parent"]=>
     string(1) "0"
     ["count"]=>
     string(2) "52"
     ["object_id"]=>
     string(6) "266909"
   }
 }
 }}}

 Actual return value:
 {{{
 array(1) {
   [1274]=>
   object(stdClass)#1032 (10) {
     ["term_id"]=>
     string(4) "1274"
     ["name"]=>
     string(10) "Staff Blog"
     ["slug"]=>
     string(5) "blogs"
     ["term_group"]=>
     string(1) "0"
     ["term_taxonomy_id"]=>
     string(4) "1284"
     ["taxonomy"]=>
     string(13) "ars_post_type"
     ["description"]=>
     string(0) ""
     ["parent"]=>
     string(1) "0"
     ["count"]=>
     string(2) "52"
     ["object_id"]=>
     string(6) "266909"
   }
 }
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24562>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list