[wp-hackers] get_the_terms() using term id as index key

Drew xoodrew at gmail.com
Mon Jan 21 16:50:36 UTC 2013


I always viewed it as saving on a foreach by returning the ids as indexes,
plus there's less chance of running into undefined offsets.

Drew
On Jan 21, 2013 9:47 AM, "William Satterwhite" <whsatterwhite at gmail.com>
wrote:

> I've never noticed this until now, but get_the_terms() uses the found
> term's id as the index key in the returned array. Is this intended? I was
> expecting the array keys to start at 0 and increment as associated terms
> for a post were found. Not a big deal since you can use array_values(); to
> reset the index starting at 0.
>
> V/r,
> --
> Hunter Satterwhite
> http://linkedin.com/in/hsatterwhite
> (252) 762-5177
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list