[wp-hackers] Term Meta - Trac'd already?

Otto otto at ottodestruct.com
Wed Jul 13 22:21:21 UTC 2011


On Wed, Jul 13, 2011 at 4:33 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> However as I write this it reminds me that what we have in fact is the need for a custom post type associated with the San Francisco category meaning that either having said relationship easily available has merit (or even turning term_taxonomy into a post itself.) I and others have proposed a variety of these types of things in the past on this list and on trac.  But in many cases just having meta for term_taxonomies would be sufficient.

I agree with the need for a custom post type in the given example. I'm
just not sure why you can't use the existing relationship methods
instead of creating something special for it.

For example, let say you have a taxonomy for your locations here.
You're applying it to normal posts. Now you have a need for something
to display the description to be used on the archive pages. For this,
I'd use a CPT called location-info or something. To then associate it
to that term in the location taxonomy, I'd simply give it that term.
Put it in that taxonomy with the term I want. Your query in the
template table to display that location-info post is then simply a
matter of retrieving the location-info CPT for the taxonomy-term that
*you're already trying to display* for posts as well. It's a natural
mechanism. Group the posts into the taxonomy and the location-info CPT
into that taxo as well.

This seems pretty universal to me. For all the cases where a
custom-tax needs a meta, because you're storing something special
about each term in the tax (like a description), then a CPT with that
term will associate it. It's simple enough to do and it makes your
queries natural. When you query, you get posts. If you query for a CPT
and the term, you'll get the post with that term. And it can let you
make multiple entries too, since you can make more than one post in
your CPT.


-Otto


More information about the wp-hackers mailing list