[wp-trac] [WordPress Trac] #21608: get_the_terms() returns an array with keys that are not starting from 0

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 16 16:01:06 UTC 2012


#21608: get_the_terms() returns an array with keys that are not starting from 0
--------------------------+------------------------------
 Reporter:  boryanka      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.4.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by scribu):

 I think the workaround is pretty easy:

 {{{
 $terms = get_the_terms( ... );
 $first_term = reset( $terms );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21608#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list