• I can’t get WP to give me child terms on a custom taxonomy, here’s an example:

    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));

    This gives me an empty array. Have I done this wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter miradev

    (@miradev)

    No comments on this in 5 days. Has anyone successfully done this? Am I the only one trying to do it?

    How do I go about figuring out if it is a bug, and if so where do I report it?

    Change the get_child_terms to get_term_children and you are fine!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom taxonomy children (get_term_children) – BUG?’ is closed to new replies.