[wp-hackers] custom post types: order by taxonomy
otto at ottodestruct.com
Mon Mar 7 20:31:06 UTC 2011
On Mon, Mar 7, 2011 at 12:56 PM, Mark E <mark at simplercomputing.net> wrote:
> Anybody know if it's possible to use query_posts or get_posts and order the
> results based on a specific taxonomy tied to a post type? The Codex doesn't
> indicate that it's possible, but I thought I'd ask anyway.
It's not possible to order by terms in a taxonomy, because it doesn't
make any real sense to do so.
Taxonomies are ways to group things together. So the point of having a
taxonomy on posts would really be to have terms in that taxonomy that
are shared between posts. If a taxonomy had terms that were only used
on one post each, then that would make the taxonomy kind of pointless.
And if the terms were shared like they should be, then ordering by it
wouldn't produce anything particularly useful.
What you should be using in such a situation is the post meta. You can
order by post meta, and it's unique to each post.
More information about the wp-hackers