[wp-hackers] get_object_term_cache doesn't accept arrays of ids or taxonomies?

Casey Bisson casey.bisson at gmail.com
Wed Sep 19 20:34:52 GMT 2007


I'm using the taxonomy to store specific metadata related to books  
and library resources.  So for a single record I've got a bunch of  
terms in taxonomies like Author, Subject, ISBN, and others, and what  
I wanted to do was grab all of them in one call.

I've worked around it pretty easily by reading $object_term_cache  
directly (this may or may not be recommended behavior):

$tags = array_intersect_key($object_term_cache[$blog_id][$id],  
array_flip($this->facets));

Where $this->facets is the array of taxonomies I care about.

Overall, though, I'm really happy with what I can do with all this.

--Casey

> wp_get_object_terms accepts multiple ids and taxonomies to allow
> slurping lots of stuff in one query.  get_object_term_cache doesn't
> have the same motivation since it is retrieving what has already been
> queried.  I'm not against adding support for multiples to
> get_object_term_cache, however, if it is useful to you.  It's too late
> to change it in 2.3 though. It would have to wait for 2.4.
>
> Ryan


More information about the wp-hackers mailing list