[wp-hackers] custom post types: order by taxonomy

Otto otto at ottodestruct.com
Tue Mar 8 00:16:52 UTC 2011

On Mon, Mar 7, 2011 at 6:04 PM, Otto <otto at ottodestruct.com> wrote:
> The important thing about taxonomies is that the terms themselves are
> without meaning. It's just a label. Now, we tend to assign it meaning,
> but really, it's just a label for a grouping. The important part about
> a taxonomy is the grouping of posts created by it, not the meaning
> assigned to the term by your brain.

I think I should expand on that a bit, for clarification purposes.

Note that I said the grouping was more important than the label. This
is true, but it doesn't mean the label has no meaning. If I make a
"People" taxonomy and use it to start assigning names to photos in my
photo library, then obviously the name has meaning. In this case, it
would mean that that person is in the photo.

But the important thing is the grouping. By using that taxonomy to
label the photos, I can now show only the photos that have a specific
label. Taxonomies are about being able to easily select a subset of
the items in question.

Now, Postmeta lets me do that as well, but not as easily or as
quickly. Postmeta is a much more customizable system, in which I can
store actual data about the item in question. I can pull that data
back, manipulate it, etc.

Sure, I could do a meta_query to get posts where people->Otto or
something, but that's going to be a slow query because the data is
stored as information and not as connections. With a taxonomy query,
I'm not checking to see what posts have people = "otto", I'm getting
the "otto" item from people, getting its ID number, then getting all
the posts that have that ID number connected to them in a relationship

Taxonomies are about relationships between posts and groupings of
posts. When the grouping matters more, a taxonomy makes sense. In the
case of people tagging photos, a taxonomy makes more sense because the
goal is to group the photos by who's in them, not to use the names of
the people in them as manipulatable data. If the data matters at all,
then it should be in postmeta instead.

If you go to Matt's site and check out his (newly revamped) photo
gallery, you can see that he labels the photos with names, exactly as
I have described above. That's using a custom people taxonomy. When
you click the names, you can see that they have URL's like
http://ma.tt/person/andrew-nacin/ which basically just off pulls a
taxonomy query. The grouping here is the important bit.


More information about the wp-hackers mailing list