[wp-trac] [WordPress Trac] #17449: get_term_link does not work on dereived terms from get_category

WordPress Trac wp-trac at lists.automattic.com
Mon May 16 04:12:55 UTC 2011


#17449: get_term_link does not work on dereived terms from get_category
--------------------------+-----------------------------
 Reporter:  zanematthew   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  3.1.2
 Severity:  minor         |   Keywords:
--------------------------+-----------------------------
 I was noticing that get_categories as of 3.0 allows you to specify a
 taxonomy, which is great! because there's lots of useful args to be passed
 into get_categories, but there seems to be a problem where once you have a
 list of terms for a given taxonomy you can not use get_term_link to
 retrieve the link to your term.


 sample:

 // Does NOT work
 // $args = array('taxonomy' => 'my_cool_tax' );
 // $terms = get_categories( $args );

 // Does WORK
 $taxonomy = 'my_cool_tax';
 $terms = get_terms( $taxonomy );

 foreach( $terms as $term ) {
    $html .= '<li><a href="'.get_term_link( $term->slug, $term->taxonomy )
 . '"'>'.$term->name.'</a></li>';
 }

 print '<ul>' . $html . '</ul>';

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17449>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list