Ticket #9323: get_term_link.9323.diff
| File get_term_link.9323.diff, 1.8 KB (added by , 17 years ago) |
|---|
-
wp-includes/taxonomy.php
2151 2151 * 2152 2152 * @since 2.5.0 2153 2153 * 2154 * @param object|int|string $term2154 * @param int $term_id The term id for which to get a link. 2155 2155 * @param string $taxonomy 2156 2156 * @return string HTML link to taxonomy term archive 2157 2157 */ 2158 function get_term_link( $term , $taxonomy ) {2158 function get_term_link( $term_id, $taxonomy ) { 2159 2159 global $wp_rewrite; 2160 $term_id = intval($term_id); 2160 2161 2161 if ( !is_object($term) ) {2162 if ( is_int($term) ) {2163 $term = &get_term($term, $taxonomy);2164 } else {2165 $term = &get_term_by('slug', $term, $taxonomy);2166 }2167 }2168 if ( is_wp_error( $term ) )2169 return $term;2170 2171 2162 // use legacy functions for core taxonomies until they are fully plugged in 2172 2163 if ( $taxonomy == 'category' ) 2173 return get_category_link((int) $term ->term_id);2164 return get_category_link((int) $term_id); 2174 2165 if ( $taxonomy == 'post_tag' ) 2175 return get_tag_link((int) $term->term_id); 2166 return get_tag_link((int) $term_id); 2167 2168 $term = &get_term($term_id, $taxonomy); 2176 2169 2170 if ( is_wp_error( $term ) ) 2171 return $term; 2172 2177 2173 $termlink = $wp_rewrite->get_extra_permastruct($taxonomy); 2178 2174 2179 2175 $slug = $term->slug; -
wp-includes/category-template.php
887 887 return false; 888 888 889 889 foreach ( $terms as $term ) { 890 $link = get_term_link( $term , $taxonomy );890 $link = get_term_link( $term->term_id, $taxonomy ); 891 891 if ( is_wp_error( $link ) ) 892 892 return $link; 893 893 $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';