[wp-hackers] Querying posts inside hierarchical custom taxonomy
Patrik Bóna
patrik.bona at mrhead.sk
Sun Mar 7 22:50:56 UTC 2010
Hi Malaiac, Hi All,
Malaic did you find some workaround for this ? I am using last nightly
build and custom taxonomies still doesn't as categories...
Guys do you have any idea what would be best way to change it ?
Many thanks
Best regards
Patrik
Malaiac wrote:
> For categories, wp_query does return posts in Category and Children categories.
> For hierarchical taxonomies, wp_query returns only posts in Taxonomy,
> no posts from Children taxonomies, and I haven't find a workaround
> yet.
>
> M
>
> 2009/9/22 Jeremy Clarke <jer at simianuprising.com>:
>
>> 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
>>>
>>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>
> _______________________________________________
> 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