[wp-hackers] Querying posts inside hierarchical custom taxonomy

Jeremy Clarke jer at simianuprising.com
Mon Sep 21 23:27:23 UTC 2009


I'm also unclear about what you're asking.

Assuming you want to get all posts in a given term AND its children,
have you checked that it doesn't already do so when you fetch the
term? For categories it already does so, though maybe not for
hierarchical custom taxonomies. The categories part in in
wp-includes/query.php :

1789    $q['category__in'] = array_merge($q['category__in'],
get_term_children($cat, 'category'));

Maybe that's helpful,


-- 
Jeremy Clarke
Code and Design | globalvoicesonline.org


On Mon, Sep 21, 2009 at 7:32 AM, scribu <scribu at gmail.com> wrote:
> To be clear:
>
> Do you want to query_posts(...) or do you want to get_terms(...) ?
>
>
> On Mon, Sep 21, 2009 at 11:35 AM, Malaiac <malaiac at gmail.com> wrote:
>
>> Custom taxonomy for posts is "places".
>> Hierarchy is like
>> Europe
>>  France
>>  Germany
>> Asia
>>  Vietnam
>>
>> I can query posts from "France" or "Vietnam".
>> How should I query posts to get all those from Europe or Asia ?
>> There is no children term query inside wp_query (query.php, around
>> line 1947, there is : $terms = get_terms($q['taxonomy'],
>> array('slug'=>$q['term'])); , with no way to ask for children terms).
>>
>> Malaiac
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> http://scribu.net
> _______________________________________________
> 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