[wp-trac] [WordPress Trac] #14399: get_term_children on non-post custom taxonomies
WordPress Trac
wp-trac at lists.automattic.com
Fri Jul 23 13:32:11 UTC 2010
#14399: get_term_children on non-post custom taxonomies
--------------------------+-------------------------------------------------
Reporter: miradev | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.0
Severity: normal | Keywords: custom taxonomy child term
--------------------------+-------------------------------------------------
1. Create a taxonomy on something 'non standard'[[BR]]
2. Create a (parent) term.[[BR]]
3. Create a child term. [[BR]]
4. Retrieve child terms of the parent term using, amongst others,
get_term_children().
Roughly:
{{{
register_taxonomy( 'where-you-live', 'user', array('hierarchical' => true,
'show_ui' => true, 'query_var' => true, 'label' => __('Where they live'))
);
$country = 'USA';
$state = 'New York';
$tax_country = wp_insert_term($country, 'where-you-live');
$country_term_id = $tax_country['term_id'];
wp_insert_term($state, 'where-you-live',
array('parent'=>$country_term_id));
$state_terms = get_child_terms($country_term_id, 'where-you-live');
error_log(print_r($state_terms,1));
}}}
I am expecting an array containing the 'New York' child term, but I get
nothing.[[BR]]
Have also tried get_terms() with child_of or parent args, which also fail
(presumably for the same reason?).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14399>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list