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

William Satterwhite whsatterwhite at gmail.com
Mon Jan 21 17:12:41 UTC 2013


Ah, I see. Thanks for the feedback!

On Mon, Jan 21, 2013 at 11:50 AM, Drew <xoodrew at gmail.com> wrote:

> 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
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Hunter Satterwhite
http://linkedin.com/in/hsatterwhite
(252) 762-5177


More information about the wp-hackers mailing list