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

Nathaniel Taintor goldenapplesdesign at gmail.com
Mon Mar 7 20:11:56 UTC 2011


I don't think that there's currently an API function for that, but if you
don't expect to be returning too many results, you can always fetch all the
posts with get_posts and order them using PHP's uasort function. I've done
this for up to a couple hundred posts; beyond a certain point, though, it
doesn't scale very well, and you're better off writing your own SQL query.



Nathaniel Taintor, Designer/Developer
*Golden Apples Design*
http://goldenapplesdesign.com

@GoldenApples | 503.877.2880
goldenapplesdesign at gmail.com



On Mon, Mar 7, 2011 at 10:56 AM, 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.
>
> Mark
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list